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


Groups > comp.lang.python > #10466

Re: NoneType and new instances

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'constructor': 0.07; '(actually': 0.09; 'bool': 0.09; 'false,': 0.09; 'am,': 0.13; 'wrote:': 0.15; '9:39': 0.16; 'instantiate': 0.16; 'cc:addr :python-list': 0.16; 'this:': 0.16; 'cc:2**0': 0.21; 'header:In- Reply-To:1': 0.22; 'thu,': 0.28; 'message-id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.30; 'unable': 0.31; 'received:209.85.161.46': 0.34; 'received:mail- fx0-f46.google.com': 0.34; 'things': 0.34; 'none': 0.35; 'subject:new': 0.36; 'but': 0.37; 'received:google.com': 0.38; 'received:209.85.161': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'returning': 0.38; 'received:209': 0.40; 'ever': 0.65; 'them:': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=iP2pObvU2hTJdVpZWeuvgI//R11dUCiFnb0YjLeHBCM=; b=SytRQsgfq/BUz2x7zJM4dqav39HSE4E8cEE+162nYMl6E1ANZ2VpRARvVmrnsPh9CS eDgczPgNR1hCZfADgxyuMF2MUrZGvcHVarRyTadWfknOjH6MGg/zBEcbMyxNaqX4+ME9 solibkIHE1deVnXYIsV1SwpS4HLnMMxS2h1yk=
MIME-Version 1.0
In-Reply-To <4E3182C3.9040306@stoneleaf.us>
References <4E3182C3.9040306@stoneleaf.us>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Thu, 28 Jul 2011 11:12:13 -0600
Subject Re: NoneType and new instances
To Ethan Furman <ethan@stoneleaf.us>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc Python <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1579.1311873164.1164.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1311873164 news.xs4all.nl 23920 [2001:888:2000:d::a6]:50388
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:10466

Show key headers only | 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