Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!ecngs!feeder2.ecngs.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.050 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'cc:addr:python-list': 0.11; 'accident.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'singleton': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'feb': 0.22; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; "i've": 0.25; 'header :In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; '(which': 0.31; '13,': 0.31; 'accidentally': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'returning': 0.36; 'pm,': 0.38; 'rather': 0.38; 'does': 0.39; 'called': 0.40; 'new': 0.61; 'course': 0.61; 'happen': 0.63; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=BkVBef02RXKQLYUy2hUxJUh7PGomGTLdTIOheeE0JW0=; b=a5tj9ZR07cL+HmrbPLifK/h8cLQA8rpC1NVPLN4GrLHynyWNOJSvgPDvaACYLHQDi2 3cwdSIKfWUzyMHoCQGM4zUtU4HdeSUIE+xmzyh8vjZF4TbTejqIXvYOHYxpf+SpVEKlX aXAqi/2tFrMnNAil+L5H/nnZVnfzFEaL94phxD5ejxyVvTRaGT8sUpOqbH5anKnN5V67 sQC4BlO6SetFKtug/mHEzRijZaiU9OW9PZTwp9EJhXnCRMoP7Kywg0SbV62kGa/H2lqo j1MmVD57RGlstlBkS/QCxXERrM8ujMQVccLjufl8gWazlJ+mYyrSwv4Y2nLINFrkWBki eCRQ== MIME-Version: 1.0 X-Received: by 10.68.200.74 with SMTP id jq10mr1114798pbc.169.1392265991879; Wed, 12 Feb 2014 20:33:11 -0800 (PST) In-Reply-To: <52fc490d$0$11128$c3e8da3@news.astraweb.com> References: <52fc34e5$0$11128$c3e8da3@news.astraweb.com> <52fc490d$0$11128$c3e8da3@news.astraweb.com> Date: Thu, 13 Feb 2014 15:33:11 +1100 Subject: Re: singleton ... again From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392265995 news.xs4all.nl 2877 [2001:888:2000:d::a6]:54735 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66153 On Thu, Feb 13, 2014 at 3:24 PM, Steven D'Aprano wrote: > Of course it can happen by accident. It's happened to me, where I've > accidentally called NoneType() (which raises, rather than returning a new > instance). It does in 2.7, yes, but not in 3.4: >>> type(None)() is None True Definitely prefer returning the singleton to raising. ChrisA