python/nondist/peps pep-0327.txt,1.4,1.5

Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1202 Modified Files: pep-0327.txt Log Message: Update to reflect the equivalence: Decimal(12345)==Decimal('12345') where the precision is three Index: pep-0327.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0327.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0327.txt 30 Jun 2004 03:37:13 -0000 1.4 --- pep-0327.txt 30 Jun 2004 04:46:47 -0000 1.5 *************** *** 729,736 **** '''''''''''''''' ! Aahz suggested the need of an explicit conversion from int, but also ! thinks it's OK if the precision in the current Context is not ! exceeded; in that case you raise ValueError. Votes in ! comp.lang.python agreed with this. --- 729,739 ---- '''''''''''''''' ! An int or long is a treated like a Decimal explicitly constructed from ! Decimal(str(x)) in the current context (meaning that the to-string rules ! for rounding are applied and the appropriate flags are set). This ! guarantees that expressions like ``Decimal('1234567') + 13579`` match ! the mental model of ``Decimal('1234567') + Decimal('13579')``. That ! model works because all integers are representable as strings without ! representation error.
participants (1)
-
rhettingerīŧ users.sourceforge.net