[issue4907] ast.literal_eval does not properly handled complex numbers

Mark Dickinson report at bugs.python.org
Sun Jan 11 18:33:55 CET 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

I'm not sure that this is desirable behaviour.  There's no such thing as a 
complex literal---only imaginary literals.  Why allow evaluation of 2+1j
but not of 2 + 1, or 2*1j.

In any case, I'm not sure that the patch behaves as intended.  For 
example,

>>> ast.literal_eval('2 + (3 + 4j)')
(5+4j)

----------
nosy: +marketdickinson

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


More information about the Python-bugs-list mailing list