[PATCH 1/4] Implement Size.__radd__ so sum works with Size instances.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 pyanaconda/storage/size.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/storage/size.py b/pyanaconda/storage/size.py
index 865634c..1906ee0 100644
--- a/pyanaconda/storage/size.py
+++ b/pyanaconda/storage/size.py
@@ -148,6 +148,10 @@ class Size(Decimal):
     def __add__(self, other):
         return Size(bytes=Decimal.__add__(self, other))
 
+    # needed to make sum() work with Size arguments
+    def __radd__(self, other):
+        return Size(bytes=Decimal.__radd__(self, other))
+
     def __sub__(self, other):
         return Size(bytes=Decimal.__sub__(self, other))
 
-- 
1.7.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux