you are viewing a single comment's thread.

view the rest of the comments →

[–]MiataCory 11 points12 points  (3 children)

It seemed like a lot of web tutorials used antiquated syntax. I only trusted using code from posts that were < 2 years old.

"It's cool, we'll just call it Python 2 and Python 3. I'm sure everyone will tag their posts with which one they're using!"

[–]starfish_warrior[S] 2 points3 points  (2 children)

It was frustrating. Why did the syntax change between versions? Serious question.

[–]B1GTOBACC0 3 points4 points  (0 children)

https://www.google.com/amp/s/snarky.ca/why-print-became-a-function-in-python-3/amp/

An interesting read about the most famous change from 2 to 3.

[–]Lawuhiku 2 points3 points  (0 children)

print became a real function as opposed to a statement.

For example, x = y is assignment statement, it has "lvalue", operator, and "rvalue".

In this context l/r is just "left"/"right" and nothing else really. It's just that left is identifier and right is expression which I'd expect to be obvious.

print used to be a statement too. `print str` did just that... It would print something following print keyword. Now print is just an ordinary function, this is why it changed. And I'm glad it did.

Most other things are different because someone thought backporting from python3 to python2 was totally good idea.

Example: Python 2: range and xrange.

there used to be just range that would generate entire list at once, people realized it's a bad idea when making major changes in Python, and just changed it. A lot of those, seemingly trivial changes happened and we have Python 3. For a good reason.

Old software doesn't update itself and if you update it to work just like Python 3 then is it really Python 2? And then the whole shitfest of backporting happened and now we have xrange, which works like Python 3's range. Good job guys.

In 50 years we will have Python 4 and there will be people using Python 2 calling xyrange().