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


Groups > comp.lang.python > #90358

Re: [Python-Dev] anomaly

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <p.f.moore@gmail.com>
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; 'example:': 0.03; 'win32': 0.03; 'subject:: [': 0.04; 'subject:Python': 0.06; 'class,': 0.07; 'practice,': 0.07; 'builtin': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'from:addr:p.f.moore': 0.16; 'from:name:paul moore': 0.16; 'subclasses': 0.16; 'subject:Dev': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'subject:] ': 0.20; 'feb': 0.22; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**1': 0.23; 'simpler': 0.24; 'paul': 0.24; 'define': 0.26; 'pass': 0.26; 'header:In-Reply- To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; '>>>>': 0.31; 'names.': 0.31; 'such.': 0.31; 'class': 0.32; 'something': 0.35; 'received:google.com': 0.35; 'wrong': 0.37; 'bad': 0.39; 'more': 0.64; 'to:addr:gmail.com': 0.65; "'3'": 0.84; '2015': 0.84; 'shadow': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=YH1M5cLDGvH1zabK/G+oVQICnpoAF2hEe/mj8R02Lk0=; b=MQ6DN2r63ANlcWQ7fCq46OYjYy4hBCvIAzEbKDJ3Oe65GvMlXCsnZu9AaRTNQgWj40 FhBCle9WafvE9gg6T3ZpDjvDKPHVBUUEmiJr5Ou6jkdxOHPQjin8j+2btFyenteTQX+r NrYYuJXi+CJK7f7766jQl3rehwsssVTAKEXAu36J12/8OjHmWEjEbJucPdUzvEX0B7+8 Q8Q8jVFrkC+2/3LLGQclMaUm60eiNH8sc2E+6b/DEGjcHt0yvCYzmRRkmi63eVqe/RAw EVbwOfo+9An09cpMSE6D+mz6Wkcl8FtUWPEw+cTcCtdFcx+zI1eec198fIYEMlz8BJnT fQ9A==
MIME-Version 1.0
X-Received by 10.60.175.72 with SMTP id by8mr7256884oec.35.1431331944884; Mon, 11 May 2015 01:12:24 -0700 (PDT)
In-Reply-To <CAMjeLr--RfnfgWc1hdOcHiEBpq3QwC7SZk-m14wM65JtpbgMLQ@mail.gmail.com>
References <CAMjeLr--RfnfgWc1hdOcHiEBpq3QwC7SZk-m14wM65JtpbgMLQ@mail.gmail.com>
Date Mon, 11 May 2015 09:12:24 +0100
Subject Re: [Python-Dev] anomaly
From Paul Moore <p.f.moore@gmail.com>
To Mark Rosenblitt-Janssen <dreamingforward@gmail.com>
Cc "python-list@python.org" <python-list@python.org>, Python Dev <python-dev@python.org>
Content-Type text/plain; charset=UTF-8
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.349.1431331954.12865.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1431331954 news.xs4all.nl 2922 [2001:888:2000:d::a6]:43357
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:90358

Show key headers only | View raw


On 10 May 2015 at 17:34, Mark Rosenblitt-Janssen
<dreamingforward@gmail.com> wrote:
> Here's something that might be wrong in Python (tried on v2.7):
>
>>>> class int(str): pass
>
>>>> int(3)
> '3'

It's not wrong as such. It is allowed to define your own class that
subclasses a builtin class, and it's allowed to shadow builtin names.
So while this is (obviously) bad practice, it's not wrong.

For a simpler example:

Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> str
<class 'str'>
>>> str = "Hello"
>>> str
'Hello'

Paul

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


Thread

Re: [Python-Dev] anomaly Paul Moore <p.f.moore@gmail.com> - 2015-05-11 09:12 +0100

csiph-web