help me get excited about python 3

Evan Driscoll edriscoll at wisc.edu
Wed Jan 4 23:41:22 EST 2012


On 1/4/2012 9:56 AM, Sean Wolfe wrote:
> I am still living in the 2.x world because all the things I want to do
> right now in python are in 2 (django, pygame). But I want to be
> excited about the future of the language. I understand the concept of
> needing to break backwards compatibility. But it's not particularly
> exciting to think about. What are the cool new bits I should be
> reading up on?
This should be enough to convince you:

~ : python
Python 2.7.1 (r271:86832, May  3 2011, 10:31:28) 
>>> 1 < "1"
True

~ : python3
Python 3.2 (r32:88445, May  3 2011, 13:26:55) 
>>> 1 < "1"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unorderable types: int() < str()

Maybe with Python 4, '1 < True' will give a TypeError too ;-).


Or if that's not enough,

~ : python 
Python 2.7.1 (r271:86832, May  3 2011, 10:31:28) 
>>> True, False = False, True
>>> "True is " + ("True" if True else "False")
'True is False'

~ : python3
Python 3.2 (r32:88445, May  3 2011, 13:26:55) 
>>> True, False = False, True
  File "<stdin>", line 1
SyntaxError: assignment to keyword

Evan





More information about the Python-list mailing list