NoneType and new instances

Ben Finney ben+python at
Thu Jul 28 17:46:38 EDT 2011

Ethan Furman <ethan at> writes:

> Why is NoneType unable to produce a None instance? I realise that None
> is a singleton

That answers your question. Because None is a singleton, the job of its
type is to make sure there are no other instances.

> but so are True and False, and bool is able to handle returning them:

Well, they don't meet the definition of a singleton, because there are
two instances of ‘bool’ :-)

There may be code out there which depends on the fact that there once
was never a ‘bool’ type, or depends on the fact that bools are also
‘int’ instances, and it's been deemed not-worth-the-trouble to break
that code.

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

In the case of ‘bool’, the rule was broken before being introduced.

 \          “Isn't it enough to see that a garden is beautiful without |
  `\      having to believe that there are fairies at the bottom of it |
_o__)                                             too?” —Douglas Adams |
Ben Finney

More information about the Python-list mailing list