type(None)()
Hans Mulder
hansmu at xs4all.nl
Thu Aug 16 08:47:47 EDT 2012
On 8/08/12 04:14:01, Steven D'Aprano wrote:
> NoneType raises an error if you try to create a second instance. bool
> just returns one of the two singletons (doubletons?) again.
>
> py> type(None)()
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> TypeError: cannot create 'NoneType' instances
Why is that?
Why doesn't it just return an existing instance of the type,
like bool, int, str and other built-in non-mutable types do?
> py> type(False)() is False
> True
Just wondering,
-- HansM
More information about the Python-list
mailing list