[issue7652] Merge C version of decimal into py3k.

Stefan Krah report at bugs.python.org
Wed Mar 7 17:17:45 CET 2012


Stefan Krah <stefan-usenet at bytereef.org> added the comment:

This issue was raised by Jim on Rietveld:

Currently, the order of arguments in Context.__init__() differs
from repr(Context):

>>> Context()
Context(prec=28, rounding=ROUND_HALF_EVEN, Emin=-999999999, Emax=999999999, capitals=1, flags=[], traps=[DivisionByZero, Overflow, InvalidOperation])
>>> 
>>> Context(28, ROUND_HALF_EVEN, -999999999, 999999999, 1, [], [DivisionByZero, Overflow, InvalidOperation])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.2/decimal.py", line 3774, in __init__
    flags = dict([(s, int(s in flags)) for s in _signals])
  File "/usr/lib/python3.2/decimal.py", line 3774, in <listcomp>
    flags = dict([(s, int(s in flags)) for s in _signals])
TypeError: argument of type 'int' is not iterable
>>> 


I find this quite ugly. The repr() order is the good one, since
it moves the flag dictionaries to the end. I wanted to change
the order in Context.__init__() to match repr(), but I'm not
sure if such a change is possible.

I don't think Python code would initialize a context without keywords,
but C extensions might.

----------
versions: +Python 3.3 -Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7652>
_______________________________________


More information about the Python-bugs-list mailing list