Changes between Version 2 and Version 4 of Ticket #250


Ignore:
Timestamp:
Feb 28, 2008, 4:04:05 PM (17 years ago)
Author:
ole
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #250 – Description

    v2 v4  
    44I suggest allowing a new boolean keyword, addition, in set_quantity so that one can say:
    55
     6{{{
    67set_quantity('elevation', elevation_data
    78set_quantity('elevation', building_data, addition=True)
    8 
     9}}}
    910
    1011It would be easy to implement using the overloading of '+' already present in class Quantity. I suggest something like this if addition is True:
    1112
     13{{{
    1214def set_quantity(quantity_name, x, addition=False):
    1315...
     
    2022    or
    2123    domain.quantities[quantity_name] += Q2
     24}}}
    2225
    2326Alternatively, we could make this behaviour the default as quantities are initialised as zero, and have a keyword 'replace'.