Menu

Value

Nicolas Hainaux
Attachments
dbg_value.png (935 bytes)
memo_value.png (1392 bytes)

This class is just a kind of wrapper for simple numbers and strings. If any other object needs to use a number or a string in its fields, it must embed it in a Value. This is to be sure that any field is actually an object that provides all methods of Value and hence can be tested, evaluated etc. as any other Calculable object (and more !).

Please note that Values do not derive from Exponented. No exponent.

All numbers stored in a Value will be converted, if necessary, into decimal.Decimal and hence will provide associated methods (like rounding methods...). Value provides itself some methods more practical to use, that are kind of shortcuts for methods from decimal.Decimal.

Possible args for __init__() : Number|String

Fields :
raw_value : (read-only field) contains the number or the string
has_been_rounded : boolean to tell if the raw_value is a number that has been rounded before
sign : is just the sign of the Value
unit : is just the unit associated to the Value

Debugging info :

Check Value's complete doc

Back


Related

Doc for dev: Core Objects

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.