Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #90300

Re: anomaly

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news.roellig-ltd.de!open-news-network.org!border2.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'builtin': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'statements': 0.09; 'sfxlen:2': 0.11; 'python': 0.11; 'jan': 0.12; 'builtins.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'strange,': 0.16; 'wrote:': 0.18; 'else,': 0.19; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'integer': 0.24; 'replace': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'class.': 0.26; 'equivalent': 0.26; 'pass': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; '>>>>': 0.31; 'class': 0.32; 'something': 0.35; 'but': 0.35; 'wrong': 0.37; 'being': 0.38; 'same.': 0.38; 'to:addr:python- list': 0.38; 'fact': 0.38; 'pm,': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'such': 0.63; 'surprise': 0.74; "'3'": 0.84; 'received:fios.verizon.net': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: anomaly
Date Sun, 10 May 2015 13:09:12 -0400
References <CAMjeLr--RfnfgWc1hdOcHiEBpq3QwC7SZk-m14wM65JtpbgMLQ@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-98-114-97-173.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
In-Reply-To <CAMjeLr--RfnfgWc1hdOcHiEBpq3QwC7SZk-m14wM65JtpbgMLQ@mail.gmail.com>
Cc python-dev@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.320.1431277765.12865.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1431277765 news.xs4all.nl 2897 [2001:888:2000:d::a6]:37258
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:90300

Show key headers only | View raw


On 5/10/2015 12:34 PM, Mark Rosenblitt-Janssen wrote:
> Here's something that might be wrong in Python (tried on v2.7):

You are being hypnotized by the fact the 'int' is a builtin name. 
Builtin names are not keywords and can intentionally be rebound.  If you 
rebind randomly, the result may seem strange, but is predictable.  This 
is why be recommend not randomly reusing names of builtins.

>>>> class int(str): pass

This in effect rebinds 'int' to the str class.  The work 'int' no longer 
has any connect to the builtin integer class.

>>>> int(3)

Equivalent to str(3)

> '3'

No surprise that str(3) == '3'.

Replace 'int' with anything else, such as 'zyz' or 'Mark' in both 
statements and the result is the same.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: anomaly Terry Reedy <tjreedy@udel.edu> - 2015-05-10 13:09 -0400

csiph-web