Jayanth Koushik <jnkoushik <at> gmail.com> writes: > "Note: When converting from a string, the string must not contain whitespace > around the central + or - operator. For example, complex('1+2j') is fine, but > complex('1 + 2j') raises ValueError." > > Why is this so?
See http://bugs.python.org/issue9574 for a bit more context. To begin with, it's not at all clear what *should* be allowed. If "1 + 2j" is valid, what about "+ 2j"? How about "+ 2"? What about things like "+1.0 + -2.3j"? Ultimately, I closed that issue because the proposed change seemed like unnecessary code churn, and there wasn't a clear consensus that the change was desirable (or even what that change should be). If it ain't broke, etc. -- Mark -- https://mail.python.org/mailman/listinfo/python-list