On 2/22/07, Neal Becker <[EMAIL PROTECTED]> wrote: > Except, all the numeric types do, including int, float, and complex. But > not bool.
Oh? In [5]: str(complex(1, 2)) Out[5]: '(1+2j)' In [6]: complex(str(complex(1, 2))) --------------------------------------------------------------------------- <type 'exceptions.ValueError'>: complex() arg is a malformed string > In fact, this is not just academic. The fact that other numeric > types act this way leaves a reasonable expectation that bool will. > Instead, bool fails in _the worst possible way_: it silently gives a _wrong > result_. I'd debate the assertion that 'bool' is a numeric type (despite being a subclass of int). For bool() to return anything other than the value of the python expression evaluated in boolean context would be _lunacy_ and there is absolutely no chance it that will be changed. -Mike _______________________________________________ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
