Live data from Hacker News

90% of Python in 90 Minutes (2013)

slideshare.net

1–10 of 61 posts

Re: 90% of Python in 90 Minutes (2013)

#3
post #2

Although this ignores most of the differences between Python 2 vs 3, note that there will be differences in iterables, classes, and print functions. Feel free to comment if you aware of any more.

I'd add unicode to this. Now the only string type is unicode in Python 3.

I think [1] and [2] are good places, not sure if there's an absolutely easy-to-navigate summary from 2-3.

[1]: https://docs.python.org/3/howto/pyporting.html [2]: http://python-future.org/compatible_idioms.html

Re: 90% of Python in 90 Minutes (2013)

#4
post #2

Although this ignores most of the differences between Python 2 vs 3, note that there will be differences in iterables, classes, and print functions. Feel free to comment if you aware of any more.

Bytes/Unicode strings is the biggie for anyone doing I/O.

Re: 90% of Python in 90 Minutes (2013)

#5
post #2

Although this ignores most of the differences between Python 2 vs 3, note that there will be differences in iterables, classes, and print functions. Feel free to comment if you aware of any more.

Generally projects that suffer from the str/bytes/unicode mess is the hardest to port in my experience as 2to3 can't really help.

Also relative/absolute imports can cause some confusing bugs.

Re: 90% of Python in 90 Minutes (2013)

#6
post #5
post #2

Although this ignores most of the differences between Python 2 vs 3, note that there will be differences in iterables, classes, and print functions. Feel free to comment if you aware of any more.

Generally projects that suffer from the str/bytes/unicode mess is the hardest to port in my experience as 2to3 can't really help. Also relative/absolute imports can cause some confusing bugs.

That's because the programmer needs to make the choice of whether the data is text or just bytes. I suppose you could write a tool to infer that choice, but it wouldn't be perfectly accurate.

Re: 90% of Python in 90 Minutes (2013)

#7
You could easily reduce that ten fold, most of the slides contain little information. Every developer already knows that you can add integers, combine booleans with and, and have alternatives with if and else. Or how lists and maps work. No need to repeat this in such detail, just list the type names, keywords and operators.

Instead focus on what is special about Python like indentation and colons, slicing, __iter__, arbitrary precision integers, ... This are the important things, otherwise you can not really say you know much about Python because it is generic stuff that applies to most languages under the sun.

Re: 90% of Python in 90 Minutes (2013)

#8
post #6
post #5

Earlier quoted context omitted.

Generally projects that suffer from the str/bytes/unicode mess is the hardest to port in my experience as 2to3 can't really help. Also relative/absolute imports can cause some confusing bugs.

That's because the programmer needs to make the choice of whether the data is text or just bytes. I suppose you could write a tool to infer that choice, but it wouldn't be perfectly accurate.

And see if that choice lines up with the v3 compatible version of any libraries they are using. Ones that touch the data anyway.

Re: 90% of Python in 90 Minutes (2013)

#10
From slide 32:

> (In Python 3 // is integer division)

I find it clearer to describe this behavior as "floor" division. You might think "integer division" would have the same results as python 3's `int(a / b)` when `a` and `b` are ints, but, no, this is not the case. I never could quite understand why all the hub-bub about "integer division" and why it should change from python 2 to python 3 because the behavior seemed natural and similar to the native integer division on most processors. Indeed its behavior is astonishingly different with negative numbers.

    $ python2 -c 'print 2/3, -2/3, int(-2./3.)'
    0 -1 0
    $ python3 -c 'print(2//3, -2//3, int(-2.//3.))'
    0 -1 -1
    $ python3 -c 'print(2/3, -2/3, int(-2./3.))'
    0.6666666666666666 -0.6666666666666666 0
Post reply on HN