Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.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.068 X-Spam-Evidence: '*H*': 0.87; '*S*': 0.01; 'class,': 0.07; '*is*': 0.09; 'builtin': 0.09; 'defines': 0.09; 'override': 0.09; 'that).': 0.09; 'python': 0.11; 'creates': 0.14; 'expecting': 0.16; 'namespace,': 0.16; 'overridden': 0.16; 'subclass': 0.16; 'wrote:': 0.18; 'basically': 0.19; '>>>': 0.22; 'header:User- Agent:1': 0.23; 'equivalent': 0.26; 'pass': 0.26; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'you?': 0.31; '(unless': 0.31; 'gary': 0.31; 'class': 0.32; 'languages': 0.32; 'skip:_ 10': 0.34; 'common': 0.35; 'something': 0.35; 'keyword': 0.36; 'wrong': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'ian': 0.60; 'new': 0.61; "you've": 0.63; 'act': 0.63; 'different': 0.65; 'charset:windows-1252': 0.65; 'within': 0.65; 'institute': 0.72; 'family': 0.73; 'received:204': 0.75; 'dr.': 0.77; "'3'": 0.84; '2015': 0.84; 'here."': 0.91; 'str.': 0.91; 'besides,': 0.93 Date: Sun, 10 May 2015 10:28:05 -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: In-Reply-To: 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: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1431279306 news.xs4all.nl 2844 [2001:888:2000:d::a6]:46426 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:90302 On 05/10/2015 09:48 AM, Rustom Mody wrote: > On Sunday, May 10, 2015 at 10:14:36 PM UTC+5:30, 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? > In C (family) languages int is a keyword > From that pov this is completely bizarre Not really. Expecting Python to act like C family languages *is* bizarre. Common Python thought:: "We're all adults here." If you want to override a builtin within your own namespace, who are we to stop you? Besides, it's still available as __builtins__.int (unless you've also overridden that). -- Dr. Gary Herron Department of Computer Science DigiPen Institute of Technology (425) 895-4418