Re: [Python-Dev] anomaly

2015-05-12 Thread Terry Reedy
On 5/11/2015 3:40 AM, Florian Bruhin wrote: [snip] This trollish thread was cross-posted to python-list, where it was semi-ok, at least in the beginning, and pydev, where it is not. It has continued on python-list with pydev removed. Please do not continue it here (on pydev). -- Terry Jan

Re: [Python-Dev] anomaly

2015-05-12 Thread Florian Bruhin
* Mark Rosenblitt-Janssen [2015-05-10 11:34:52 -0500]: > Here's something that might be wrong in Python (tried on v2.7): > > >>> class int(str): pass > > >>> int(3) > '3' What's so odd about this? "class int" is an assignment to "int", i.e. what you're doing here is basically: int = str int(3

Re: [Python-Dev] anomaly

2015-05-11 Thread Paul Moore
On 10 May 2015 at 17:34, Mark Rosenblitt-Janssen 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 buil

Re: [Python-Dev] anomaly

2015-05-11 Thread Mark Rosenblitt-Janssen
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 ___ Python-Dev mailing list Python-Dev@python.org https://mail.py

[Python-Dev] anomaly

2015-05-11 Thread Mark Rosenblitt-Janssen
Here's something that might be wrong in Python (tried on v2.7): >>> class int(str): pass >>> int(3) '3' Mark ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mai