| 10 | 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 | def set_quantity(quantity_name, x, addition=False): |
| 13 | ... |
| 14 | if addition is True: |
| 15 | #create new temporary quantity |
| 16 | Q = Quantity(domain) |
| 17 | Q.set_values(x) |
| 18 | |
| 19 | quantities[quantity_name] += Q |
| 20 | |
| 21 | |
| 22 | |
| 23 | Alternatively, we could make this behaviour the default as quantities are initialised as zero, and have a keyword 'replace'. |
| 24 | On the other hand, this could be confusing whenever a code needs to change a quantity. |
| 25 | |
| 26 | |
| 27 | |
| 28 | |