On 2/22/07, Neal Becker <ndbecker2 at gmail.com> 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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4