News for hackers. Stuff that matters.
Re:PEP 435 Accepted – Adding an Enum type to the Python stan... by cma on Friday May 10, 2013 @08:57PM (#5689352)
Python accepts:

     1 + True == False + 2

It should have to be:

     1 + int(True) == int(False) + 2
Re:PEP 435 Accepted – Adding an Enum type to the Python stan... by ubernostrum on Friday May 10, 2013 @09:25PM (#5689402)
Python accepts this because bool is a subclass of int, and True and False have defined integer values (1 and 0 respectively).

Which means there's no coercion or conversion going on here. For what you think it "should" be, Python would have to break Liskov substitution for subclasses of int.

Re:PEP 435 Accepted – Adding an Enum type to the Python stan... by cma on Saturday May 11, 2013 @01:07PM (#5691248)
It shouldn't be a subclass of int. http://arxiv.org/abs/math/9205211
Re:PEP 435 Accepted – Adding an Enum type to the Python stan... by ubernostrum on Saturday May 11, 2013 @11:02PM (#5692950)
You're free to argue that. But the fact that it is, and behaves correctly as a subclass of int, does not make Python be weakly typed. In fact, rather the opposite.
Re:PEP 435 Accepted – Adding an Enum type to the Python stan... by pekk on Saturday May 11, 2013 @02:06PM (#5691450)
Then it gets fixed, and everyone screams because it's not backward compatible (Python 3).
Re:PEP 435 Accepted – Adding an Enum type to the Python stan... by cma on Saturday May 11, 2013 @02:37PM (#5691583)
It should have just been part of Python 3.
Re:PEP 435 Accepted – Adding an Enum type to the Python stan... by mixmastamyk on Sunday May 12, 2013 @05:37PM (#5695960)
Yep, but they didn't aim to or succeed in 'fixing everything' in python3, just the most pressing items.

Here's to Python 4!