NoneType and new instances

Ian Kelly ian.g.kelly at gmail.com
Thu Jul 28 13:12:13 EDT 2011


On Thu, Jul 28, 2011 at 9:39 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
> 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:

The bool constructor works (actually just returns one of the existing
singletons) so that you can do things like this:

truth_value = bool(x + 5)
return my_dict[truth_value]

Why would you ever need to instantiate NoneType?



More information about the Python-list mailing list