Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '3.2': 0.05; 'python': 0.08; 'bool': 0.09; 'false,': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'none):': 0.09; 'received:gator410.hostgator.com': 0.09; '~ethan~': 0.09; 'win32': 0.12; '"copyright",': 0.16; '"credits"': 0.16; '"license"': 0.16; '8.0,': 0.16; 'received:72.11': 0.16; 'received:72.11.125': 0.16; 'received:72.11.125.166': 0.16; 'true,': 0.19; '(most': 0.21; "aren't": 0.22; 'feb': 0.23; 'traceback': 0.25; 'bit': 0.28; 'typeerror:': 0.30; 'unable': 0.31; 'cases': 0.32; 'break': 0.33; 'to:addr:python-list': 0.34; 'header:User-Agent:1': 0.34; 'none': 0.35; 'last):': 0.35; 'subject:new': 0.36; 'file': 0.36; 'but': 0.37; 'returning': 0.38; 'to:addr:python.org': 0.39; 'received:websitewelcome.com': 0.65; 'received:184': 0.67; 'violation': 0.67; 'special': 0.67; "'nonetype'": 0.84; 'received:69.41.242': 0.84; 'received:69.41.242.20': 0.84; 'them:': 0.84; '-->': 0.91; '0.0': 0.91; 'received:gateway02.websitewelcome.com': 0.93 Date: Thu, 28 Jul 2011 08:39:47 -0700 From: Ethan Furman User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: Python Subject: NoneType and new instances 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: mail.admailinc.com ([192.168.10.136]) [72.11.125.166]:1717 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 1 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: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1311866659 news.xs4all.nl 23935 [2001:888:2000:d::a6]:39863 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:10458 Consider: Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. --> for ins in ({0:'0'}, (1,), set([2, 3]), [4, 5], 6, 'seven', ... 8.0, True, None): ... print(type(ins)) ... type(ins)() ... {} () set() [] 0 '' 0.0 False Traceback (most recent call last): File "", line 3, in TypeError: cannot create 'NoneType' instances 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: --> bool(0) is bool(0) True This feels like a violation of 'Special cases aren't special enough to break the rules.' ~Ethan~