anomaly

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon May 11 02:21:52 EDT 2015


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




More information about the Python-list mailing list