Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #90358 > unrolled thread
| Started by | Paul Moore <p.f.moore@gmail.com> |
|---|---|
| First post | 2015-05-11 09:12 +0100 |
| Last post | 2015-05-11 09:12 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [Python-Dev] anomaly Paul Moore <p.f.moore@gmail.com> - 2015-05-11 09:12 +0100
| From | Paul Moore <p.f.moore@gmail.com> |
|---|---|
| Date | 2015-05-11 09:12 +0100 |
| Subject | Re: [Python-Dev] anomaly |
| Message-ID | <mailman.349.1431331954.12865.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web