Complex evaluation bug
gherron at islandtraining.com
Thu May 18 18:59:04 CEST 2006
>a = 1+3j
>Why does this not work ? It should
By normal conventions in Python, "str" attempts only to make a "nice"
human readable representation. The function "repr" is usually expected
to provide output that can be parsed back into the original object.
(Although for the numeric complex type the two produce identical results.)
Further, constructors are rarely expected to parse a string
representation to return an object. The function "eval" is usually
expected to provide that functionality.
So, putting them together, you could expect
to reproduce a, and in fact it does so.
More information about the Python-list