Changes between Version 2 and Version 4 of Ticket #250
- Timestamp:
- Feb 28, 2008, 4:04:05 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #250 – Description
v2 v4 4 4 I suggest allowing a new boolean keyword, addition, in set_quantity so that one can say: 5 5 6 {{{ 6 7 set_quantity('elevation', elevation_data 7 8 set_quantity('elevation', building_data, addition=True) 8 9 }}} 9 10 10 11 It would be easy to implement using the overloading of '+' already present in class Quantity. I suggest something like this if addition is True: 11 12 13 {{{ 12 14 def set_quantity(quantity_name, x, addition=False): 13 15 ... … … 20 22 or 21 23 domain.quantities[quantity_name] += Q2 24 }}} 22 25 23 26 Alternatively, we could make this behaviour the default as quantities are initialised as zero, and have a keyword 'replace'.