Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'that?': 0.05; 'raises': 0.07; 'type,': 0.07; 'bool': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'instance.': 0.09; 'message-id:@stoneleaf.us': 0.09; 'received:184.172': 0.09; 'received:gator410.hostgator.com': 0.09; 'subject:None': 0.09; 'typeerror:': 0.09; '~ethan~': 0.09; 'complained': 0.16; 'enough.': 0.16; 'loud': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'subject:type': 0.16; 'wrote:': 0.17; 'instance': 0.17; '"",': 0.22; 'int,': 0.22; 'second': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '(most': 0.27; 'ago': 0.27; "doesn't": 0.28; "d'aprano": 0.29; 'steven': 0.29; 'str': 0.29; 'error': 0.30; 'file': 0.32; 'instances': 0.33; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'built-in': 0.35; 'two': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'received:69.56': 0.65; 'received:gateway02.websitewelcome.com': 0.91 Date: Thu, 16 Aug 2012 09:07:58 -0700 From: Ethan Furman User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: python-list@python.org Subject: Re: type(None)() References: <502cebf4$0$6905$e4fe514c@news2.news.xs4all.nl> In-Reply-To: <502cebf4$0$6905$e4fe514c@news2.news.xs4all.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator410.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([192.168.10.136]) [72.11.125.166]:4157 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 3 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ== X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345133476 news.xs4all.nl 6857 [2001:888:2000:d::a6]:33377 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27175 Hans Mulder wrote: > On 8/08/12 04:14:01, Steven D'Aprano wrote: >> NoneType raises an error if you try to create a second instance. bool >> just returns one of the two singletons (doubletons?) again. >> >> py> type(None)() >> Traceback (most recent call last): >> File "", line 1, in >> TypeError: cannot create 'NoneType' instances > > Why is that? An oversight, and until a few months ago nobody had complained loud enough. ;) > Why doesn't it just return an existing instance of the type, > like bool, int, str and other built-in non-mutable types do? In 3.3 it now does. ~Ethan~