On 04/25/2013 05:27 PM, Steven D'Aprano wrote: > On 26/04/13 09:56, MRAB wrote: >> On the other hand: >> >> type(value)(value) == value >> >> would return True for the built-in types (will certain exceptions, such >> as when value is float("NaN")). > > Not an exception, that works fine in 3.3: > >>>> value = float('nan') >>>> type(value)(value) > nan You missed the == part: >>> type(value)(value) == value False >> Let's ask the Zen: >> >> Special cases aren't special enough to break the rules. >> >> Although practicality beats purity. > > > I cannot think of any use-case where I would actively want > NoneType(None) to fail. That would be like having bool(True) > raise an exception. > > On the other hand, NoneType(x) for any other x ought to fail. Or, since the purpose of NoneType is to return None, just return None no matter what! Kind'a like 0 * anything == 0. -- ~Ethan~
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