Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #10466

Re: NoneType and new instances

References <4E3182C3.9040306@stoneleaf.us>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2011-07-28 11:12 -0600
Subject Re: NoneType and new instances
Newsgroups comp.lang.python
Message-ID <mailman.1579.1311873164.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Jul 28, 2011 at 9:39 AM, Ethan Furman <ethan@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?

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: NoneType and new instances Ian Kelly <ian.g.kelly@gmail.com> - 2011-07-28 11:12 -0600
  Re: NoneType and new instances Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-29 11:20 +1000

csiph-web