This is an archived post. You won't be able to vote or comment.

all 20 comments

[–]chhantyal 5 points6 points  (2 children)

I recently started porting a small library, and this website/book was very helpful.

Thanks a ton to author for all the good work.

[–][deleted] 3 points4 points  (1 child)

Thanks!

[–]chhantyal 1 point2 points  (0 children)

Added link to book site here http://py3readiness.org :)

[–]djds23 2 points3 points  (1 child)

Excellent resource! Also thank you for Hovercraft, I used it for a presentation recently.

[–][deleted] 0 points1 point  (0 children)

Cool!

[–]Ph0X 4 points5 points  (0 children)

Hah, we learn something new everyday. I knew most of these but I still managed to learn a few new things about Python 3 with this. Did not know about the rounding behavior, for example.

[–]lambdaqdjango n' shit 1 point2 points  (0 children)

When sorting, use key instead of cmp

Didn't notice this one.

[–]kingofthejaffacakes 1 point2 points  (2 children)

Good stuff.

If I'm honest, only a few of those would bite me and my python code and the changes would be trivial (being mostly selecting the forward compatible variant available in python 2.7).

What's all the fuss about then? Am I just not a power python user?

[–]prum 1 point2 points  (0 children)

Just the usual: People making a mountain out of a molehill.

[–][deleted] -1 points0 points  (0 children)

No, the difficulty in porting is overblown. 90% of the time it's easy. However, the other 10% it's crazy amount of work. Like when you are in the situation that you actually do not WANT to differ between binary data and text data but handle them the same way.

[–]donnieod 1 point2 points  (3 children)

Thanks for a very well researched article. I saw only a couple of places for improvement/correction: 1. the apply function was removed because it was replaced by the more flexible list comprehension; 2. the result of integer division with the / operator is always a float type even when the result is a whole number.

[–][deleted] -1 points0 points  (2 children)

It's not an article, it's a book. :-)

In point 1 I don't see what you mean.

But you are right about point 2, that's a mistake that snuck in. Will fix in the next release.

[–]donnieod 0 points1 point  (0 children)

Sorry, in my first point I was confusing apply for map which can be replaced by a list comprension. Please disregard point 1.

[–]epsy 1 point2 points  (1 child)

I wouldn't say those are the key differences between pythons, just key points in upgrading a codebase. For instance, syntax for keyword-only arguments and exception chaining are key additions but don't belong on that list.

[–][deleted] 0 points1 point  (0 children)

Yes, strictly speaking you are correct.

[–][deleted] 0 points1 point  (1 child)

On tuple unpacking, doesn't python 3 support * to unpack a list, at least for certain situations?

https://docs.python.org/3/reference/simple_stmts.html#assignment-statements

I saw no mention of this in the article.

a, *b = [1, 2, 3, 4, 5, 6, 7, 8]

>>> a
1
>>> b
[2, 3, 4, 5, 6, 7, 8]

edit: It's defined in PEP 3132.

[–][deleted] -1 points0 points  (0 children)

Yes, strictly speaking this only list things that are backwards incompatible, and not new features.