Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!lightspeed.eweka.nl!lightspeed.eweka.nl!newsfeed.xs4all.nl!newsfeed2a.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.054 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'class,': 0.07; 'plenty': 0.07; 'builtin': 0.09; 'defines': 0.09; 'indeed,': 0.09; 'python': 0.11; 'creates': 0.14; 'definition.': 0.16; 'expecting': 0.16; 'keyword.': 0.16; 'subclass': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'basically': 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'sorry,': 0.24; 'define': 0.26; 'equivalent': 0.26; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'gary': 0.31; 'keywords,': 0.31; 'yes.': 0.31; 'class': 0.32; 'something': 0.35; 'but': 0.35; 'should': 0.36; 'wrong': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'called': 0.40; 'ian': 0.60; 'new': 0.61; "you're": 0.61; 'making': 0.63; 'different': 0.65; 'charset:windows-1252': 0.65; 'lose': 0.68; 'institute': 0.72; 'received:204': 0.75; 'dr.': 0.77; 'gain': 0.79; "'3'": 0.84; '2015': 0.84; 'huh?': 0.84; 'str.': 0.91 Date: Sun, 10 May 2015 18:07:36 -0700 From: Gary Herron User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: anomaly References: <7169d38e-b21c-472e-b0e3-544ed37fbfd2@googlegroups.com> In-Reply-To: <7169d38e-b21c-472e-b0e3-544ed37fbfd2@googlegroups.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1431306462 news.xs4all.nl 2835 [2001:888:2000:d::a6]:59623 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3753 X-Received-Body-CRC: 2627706173 Xref: csiph.com comp.lang.python:90320 On 05/10/2015 05:48 PM, zipher wrote: > On Sunday, May 10, 2015 at 11:44:36 AM UTC-5, Ian wrote: >> On Sun, May 10, 2015 at 10:34 AM, Mark Rosenblitt-Janssen >> wrote: >>> Here's something that might be wrong in Python (tried on v2.7): >>> >>>>>> class int(str): pass >> This defines a new class named "int" that is a subclass of str. It has >> no relation to the builtin class int. >> >>>>>> int(3) >>> '3' >> This creates an instance of the above "int" class, which is basically >> equivalent to calling "str(3)". >> >> Were you expecting a different result? > Sorry, yes. If you're going to define a concept called "keywords", I don't think you should allow them to be shadowed by a class definition. > > Mark Huh? Python has plenty of keywords, and indeed, none of them can be redefined or shadowed. But you would gain nothing (and lose a bit or dynamic-language freedom) by making int a keyword. -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418