Live data from Hacker News

Python 2 vs. Python 3: A retrospective

dropbox.com

41–50 of 113 posts

Re: Python 2 vs. Python 3: A retrospective

#41

This is my problem with Python: "Rename func_name —> __name__, etc Rename .next() —> .__next__()" Too many ugly renames, too few alternatives of doing things. To be honest the only attractive thing to me is all the libraries that they support but I don't find the language itself interesting.

__ is basically a namespace for official language extensions. How would you suggest they do it? Prevent "next()" from being a valid method name?

There's no need to make it not be valid. C++ uses begin() and end() for obtaining iterators to containers, but nothing's stopping you from using those method names for your own purposes.

It's just that if you want to use a few new language niceties like range-based for loops then you'll need to conform to that convention.

Re: Python 2 vs. Python 3: A retrospective

#42
It seems like I've been reading about the difficulties of Python V2 -> V3 for awhile. Why is that? Is this Python upgrade unusually difficult/ambitious? Or is the Python community just very reluctant to jump on new things?

Re: Python 2 vs. Python 3: A retrospective

#43

I would have been more interested in learning Python if there wasn't such a great divide. I read the first chapter of several books that said "Python 3 is out, but we're going to stick with 2.7 because too much shit is broken".

That was true early on in Python 3, but it's not true now.

Re: Python 2 vs. Python 3: A retrospective

#44

I would have been more interested in learning Python if there wasn't such a great divide. I read the first chapter of several books that said "Python 3 is out, but we're going to stick with 2.7 because too much shit is broken".

Are those books, books that came out this year?

Re: Python 2 vs. Python 3: A retrospective

#45

This is my problem with Python: "Rename func_name —> __name__, etc Rename .next() —> .__next__()" Too many ugly renames, too few alternatives of doing things. To be honest the only attractive thing to me is all the libraries that they support but I don't find the language itself interesting.

Not having alternatives is python's greatest strength. The language is easy to read because as much as possible there is only one way to write a given concept.

Re: Python 2 vs. Python 3: A retrospective

#46

I would have been more interested in learning Python if there wasn't such a great divide. I read the first chapter of several books that said "Python 3 is out, but we're going to stick with 2.7 because too much shit is broken".

As someone who learned Python when 3.2 came out, I completely agree with you. I have only really used Python 2.7!

Because too much shit is broken (NumPy, hello). Because Python 3 has been the default on basically no system ever (OK, maybe this is changing right now, slowly).

As Guido says, it's been five years and it will take another five. This whole experiment has been a huge misstep for Python, an absolutely massive gaffe. Some of Python's peers did it too, roughly around the same time (Perl, and to a lesser extent Ruby).

Python (Guido?) noticed its own maturity a bit too late. The damage is incredible; along with the performance stuff (which is in a way easier to overcome) this may be a key factor leading to the fall of a great language.

Re: Python 2 vs. Python 3: A retrospective

#47
post #42

It seems like I've been reading about the difficulties of Python V2 -> V3 for awhile. Why is that? Is this Python upgrade unusually difficult/ambitious? Or is the Python community just very reluctant to jump on new things?

It's a big, ambitious update. The biggest difference is forcing users to distinguish between strings and byte sequences; essentially programs now have to be encoding-aware (at least if they use any of the standard library functions). Which is a Good Thing, but can require a ton of work for existing codebases.

Re: Python 2 vs. Python 3: A retrospective

#48

I'd really like to see the video for these slides. But here's what caught my interest: Set and dict comprehensions {x**2 for x in range(10)} {x: x**2 for x in range(10)} Why reduce() must die: ... the applicability of reduce() is pretty much limited to associative operators, and in all other cases it's better to write out the accumulation loop explicitly. int [divided by] int should return float nonlocal Explicit non…

You know what's funny? All of those things could have been done in Python 2.8, apart from the int division change. And the division change does as much harm as good, because lots of people use Python and also use another language where int division works the "old fashioned way"; for them (me) this change is counter-productive because it adds a pointless distinction. It is a great change for programming novices, for sure, but that's only part of Python's audience, and probably won't be the longest-lived part.

Re: Python 2 vs. Python 3: A retrospective

#49
post #42

It seems like I've been reading about the difficulties of Python V2 -> V3 for awhile. Why is that? Is this Python upgrade unusually difficult/ambitious? Or is the Python community just very reluctant to jump on new things?

IMHO: mostly the problem is splitting the bytes/unicode types that were lumped in Python2

http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/

Re: Python 2 vs. Python 3: A retrospective

#50
post #46

I would have been more interested in learning Python if there wasn't such a great divide. I read the first chapter of several books that said "Python 3 is out, but we're going to stick with 2.7 because too much shit is broken".

As someone who learned Python when 3.2 came out, I completely agree with you. I have only really used Python 2.7! Because too much shit is broken (NumPy, hello). Because Python 3 has been the default on basically no system ever (OK, maybe this is changing right now, slowly). As Guido says, it's been five years and it will take another five. This whole experiment has been a huge misstep for Python, an absolutely massi…

On the other hand, my experience has been very different: I learned Python when 3.2 was current as well, using Lutz' "Learning Python", which takes the approach of "teach Python 3, and explain how 2 is different whenever necessary". I've followed suit and taken the approach of writing Python 3 code first, and to make it work on 2.7 only when I need to, which I found fairly easy to do, though it can make the code a bit uglier sadly (writing cross-version-compatible metaclass code is the one that annoys me, since it adds some verbosity).

I'm looking forward to 2.x dying out to eliminate that retrofitting step (and it's happening: the improving dependency landscape means I find I have to do it less and less often), but I've not experienced any major pain overall. From where I'm sitting, Python 3 is a better, cleaner language, and as someone new to Python, I'm happier for it.

Post reply on HN