Consider:

Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
--> for ins in ({0:'0'}, (1,), set([2, 3]), [4, 5], 6, 'seven',
... 8.0, True, None):
...   print(type(ins))
...   type(ins)()
...
<class 'dict'>
{}
<class 'tuple'>
()
<class 'set'>
set()
<class 'list'>
[]
<class 'int'>
0
<class 'str'>
''
<class 'float'>
0.0
<class 'bool'>
False
<class 'NoneType'>
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
TypeError: cannot create 'NoneType' instances

Why is NoneType unable to produce a None instance? I realise that None is a singleton, but so are True and False, and bool is able to handle returning them:

--> bool(0) is bool(0)
True

This feels like a violation of 'Special cases aren't special enough to break the rules.'

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to