'complex' function with string argument.
rosuav at gmail.com
Mon Mar 17 19:59:50 CET 2014
On Tue, Mar 18, 2014 at 5:15 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
>>> This '3 + 2j' is not a number, its an algebraic sum.
>>> This '3+2j' is a complex number. Ok, maybe not, but its closer to what
>>> we expect (I'm sorry, but I like i instead of j )
>>Hmm. That's a pretty tricky distinction.
> Is "-2.0" a literal?
> What's the outcome of
If you mean (-2.0).__str__(), then it returns '-2.0', but that proves
nothing. Lots of objects have a str() which isn't a literal. Closer to
what you're talking about would be repr(), but even then, it doesn't
prove that something's a literal. The easiest way to tell is probably
It's an expression consisting of unary minus and the float literal 2.0.
More information about the Python-list