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


Groups > comp.lang.python > #90315 > unrolled thread

Re: anomaly

Started byMark Rosenblitt-Janssen <dreamingforward@gmail.com>
First post2015-05-10 19:14 -0500
Last post2015-05-11 16:21 +1000
Articles 2 — 2 participants

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.


Contents

  Re: anomaly Mark Rosenblitt-Janssen <dreamingforward@gmail.com> - 2015-05-10 19:14 -0500
    Re: anomaly Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-11 16:21 +1000

#90315 — Re: anomaly

FromMark Rosenblitt-Janssen <dreamingforward@gmail.com>
Date2015-05-10 19:14 -0500
SubjectRe: anomaly
Message-ID<mailman.329.1431303268.12865.python-list@python.org>
In case the example given at the start of the thread wasn't
interesting enough, it also works in the other direction:

>>> class str(int):  pass

>>> str('2')
2  #<----- an integer!!!

Mark

[toc] | [next] | [standalone]


#90350

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2015-05-11 16:21 +1000
Message-ID<55504a81$0$13004$c3e8da3$5496439d@news.astraweb.com>
In reply to#90315
On Monday 11 May 2015 10:14, Mark Rosenblitt-Janssen wrote:

> In case the example given at the start of the thread wasn't
> interesting enough, it also works in the other direction:
> 
>>>> class str(int):  pass
> 
>>>> str('2')
> 2  #<----- an integer!!!


Thank the gods that you're around to point this out to us, because we never 
would have extrapolated from the fact that int can be rebound to discover 
that the same applies to str!



-- 
Steve

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web