Re: Complex evaluation bug

2006-05-22 Thread of
Heiko Wundram wrote: > Am Freitag 19 Mai 2006 18:03 schrieb Paul McGuire: > >>An eval-less approach - the problem is the enclosing parens. >> > > > I've just submitted two patches to the Python bugtracker at: > > http://sourceforge.net/tracker/index.php?func=detail&aid=1491866&group_id=5470&ati

Re: Complex evaluation bug

2006-05-19 Thread Heiko Wundram
Am Freitag 19 Mai 2006 18:03 schrieb Paul McGuire: > An eval-less approach - the problem is the enclosing parens. > I've just submitted two patches to the Python bugtracker at: http://sourceforge.net/tracker/index.php?func=detail&aid=1491866&group_id=5470&atid=305470 which either change the rep

Re: Complex evaluation bug

2006-05-19 Thread Paul McGuire
"Christophe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Oups, I was too fast to read what was written. I though you only changed > one of the terms ( str -> repr ). > > You'll note that repr and str produce the exact same result for complex. > And also, I'm not sure using eval a

Re: Complex evaluation bug

2006-05-19 Thread Christophe
Fredrik Lundh a écrit : > Christophe wrote: > >>> So, putting them together, you could expect >>>eval(repr(a)) >>> to reproduce a, and in fact it does so. >> >> >> Says who ? >> >> Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] >> on win32 >> Type "help", "copyright", "

Re: Complex evaluation bug

2006-05-19 Thread Fredrik Lundh
Christophe wrote: >> So, putting them together, you could expect >>eval(repr(a)) >> to reproduce a, and in fact it does so. > > Says who ? > > Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more informa

Re: Complex evaluation bug

2006-05-19 Thread Christophe
Gary Herron a écrit : > of wrote: > >> a = 1+3j >> complex(str(a)) >> >> Why does this not work ? It should >> >> > Says who? > By normal conventions in Python, "str" attempts only to make a "nice" > human readable representation. The function "repr" is usually expected > to provide output th

Re: Complex evaluation bug

2006-05-18 Thread Paul McGuire
"Mel Wilson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > of wrote: > > a = 1+3j > > complex(str(a)) > > > > Why does this not work ? It should > > It would be nice. > Looks like str(1+3j) is returning an expression in string > form. Maybe there is no actual complex literal. > Th

Re: Complex evaluation bug

2006-05-18 Thread Mel Wilson
of wrote: > a = 1+3j > complex(str(a)) > > Why does this not work ? It should It would be nice. Looks like str(1+3j) is returning an expression in string form. Maybe there is no actual complex literal. eval (str(1+3j)) works. Python 2.4.2 (#1, Jan 23 2006, 21:24:54) [GCC 3.3.4] on linux2 Type

Re: Complex evaluation bug

2006-05-18 Thread [EMAIL PROTECTED]
py> c = complex(1, 3) py> print c (1+3j) py> d = complex('1+3j') py> print d (1+3j) py> str(1+3j) '(1+3j)' complex takes two numbers, or a string representing a complex number. the string you supply isn't a representation of valid complex number. -- http://mail.python.org/mailman/listinfo/pytho

Re: Complex evaluation bug

2006-05-18 Thread Gary Herron
of wrote: >a = 1+3j >complex(str(a)) > >Why does this not work ? It should > > Says who? 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 o

Re: Complex evaluation bug

2006-05-18 Thread Brian Blazer
I am not exactly sure what is going on, but I get the error: ValueError: complex() arg is a malformed string I think that it might be because the value of 'j' is not defined. But I am a newbie so I could very well be wrong. Brian Blazer [EMAIL PROTECTED] On May 18, 2006, at 11:36 AM, of wro

Complex evaluation bug

2006-05-18 Thread of
a = 1+3j complex(str(a)) Why does this not work ? It should -- http://mail.python.org/mailman/listinfo/python-list