r/Python • Freelancer. AnyFactor.xyz • Sep 16 '20

News An update on Python 4

Post image
3.3k Upvotes

389 comments sorted by

View all comments

333

u/[deleted] Sep 16 '20

What was the transition from 1 to 2 like?

270

u/NoLongerUsableName import pythonSkills Sep 16 '20

If this article is accurate, it was pretty smooth, unlike the transition from 2 to 3.

→ More replies (5)

60

u/roerd Sep 16 '20

Here's the list of the most important changes:

Overview of Changes Since 1.6

There are many new modules (including brand new XML support through the xml package, and i18n support through the gettext module); a list of all new modules is included below. Lots of bugs have been fixed.

The process for making major new changes to the language has changed since Python 1.6. Enhancements must now be documented by a Python Enhancement Proposal (PEP) before they can be accepted.

There are several important syntax enhancements, described in more detail below:

  • Augmented assignment, e.g. x += 1

  • List comprehensions, e.g. [x**2 for x in range(10)]

  • Extended import statement, e.g. import Module as Name

  • Extended print statement, e.g. print >> file, "Hello"

Other important changes:

  • Optional collection of cyclical garbage

So quite a few important new features, but nothing that was breaking backwards compatibility.

61

u/mkdz Sep 16 '20

Wow, I can't imagine not having list comprehensions

46

u/[deleted] Sep 17 '20

List comprehension is the feature that, to me, defines Python. It's simple, powerful, versatile, intuitive, and broadly applicable. A wonderful replacement for loops and iteration. I've been using set comprehension and dictionary comprehension, too.

20

u/Mr-Stutch Sep 17 '20

a wonderful replacement for loops or a wonderful replacement for loops?

→ More replies (3)
→ More replies (6)

28

u/RegalSalmon Sep 16 '20

But can you...comprehend it?

→ More replies (1)

7

u/case_O_The_Mondays Sep 17 '20

Whoa. Didn’t know Python supported redirection on print, back in the day.

0

u/[deleted] Sep 17 '20

[deleted]

→ More replies (2)
→ More replies (4)

386

u/[deleted] Sep 16 '20

Nothing compared to the transition from 0 to 1.

145

u/NoLongerUsableName import pythonSkills Sep 16 '20

Yeah, it was kind of like the transition from -1 to 0.

128

u/[deleted] Sep 16 '20

-1 was dark times

99

u/ShevekUrrasti Sep 16 '20

Coding backwards was kind of nice, actually.

100

u/mdarty Arch Sep 16 '20

I'm great at that. Taking working code, breaking it. Troubleshooting and finally deleting everything.

12

u/Ruben_NL Sep 16 '20

That hits home...

→ More replies (3)
→ More replies (4)

22

u/TheHumanParacite Sep 16 '20

Installing it would randomly unwrite code that hadn't yet been written.

11

u/master5o1 Sep 16 '20

The real trick was to uninstall it and get unwritten code to be randomly written.

→ More replies (1)

20

u/jftuga pip needs updating Sep 16 '20

Yes. IIRC it was called Perl

→ More replies (2)
→ More replies (4)
→ More replies (1)

29

u/twotime Sep 16 '20

It was mostly (if not fully) backward compatible. So much easier and faster than 2=>3

17

u/jrbattin Sep 16 '20

Buttery smooth. I “ported” 8000 lines of Python code from 1.5.2 to 2.6 years ago. It took a day or so and that’s only because I insisted on refactoring in Python 2.6 niceties and leaning on the standard library more.

22

u/MrCaptainPirate Sep 17 '20

Transitioning from 1 to 2 was like going down a nice water slide

Transitioning from 2 to 3 was like going down a piping hot stainless steal slide in the middle of summer and then getting hit in the face with a brick at the end.

4

u/ThunderousOath Sep 17 '20

Perfect anology

→ More replies (6)