Addenda:

j.) The same rules would need to apply to all forms of the Decimal
contructor, so Decimal(someint) would also need to truncate/round if it
has more than precision digits -- likewise with Decimal(fromtuple) and
Decimal(fromdecimal).  All are problematic.  Integer conversions are
expected to be exact but may not be after the change.  Conversion from
another decimal should be idempotent but implicit rounding/truncation
will break that.  The fromtuple/totuple round-trip can get broken.  You
generally specify a tuple when you know exactly what you want.  

k.) The biggest client of all these methods is the Decimal module
itself.  Throughout the implementation, the code calls the Decimal
constructor to create intermediate values.  Every one of those calls
would need to be changed to specify a context.  Some of those cases are
not trivially changed (for instance, the hash method doesn't have a
context but it needs to check to see if a decimal value is exactly an
integer so it can hash to that value).  Likewise, how do you use a
decimal value for a dictionary key when the equality check is context
dependent (change precision and lose the ability to reference an entry)?


Be careful with this proposed change.  It is a can of worms.
Better yet, don't do it.  We already have a context aware
constructor method if that is what you really want.



Raymond
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to