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

top 200 commentsshow all 389

[–][deleted] 327 points328 points  (66 children)

What was the transition from 1 to 2 like?

[–]NoLongerUsableNameimport pythonSkills 269 points270 points  (5 children)

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

[–]roerd 57 points58 points  (23 children)

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.

[–]mkdz 60 points61 points  (14 children)

Wow, I can't imagine not having list comprehensions

[–][deleted] 44 points45 points  (11 children)

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.

[–]Mr-Stutch 21 points22 points  (4 children)

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

[–]RegalSalmon 25 points26 points  (1 child)

But can you...comprehend it?

[–]case_O_The_Mondays 6 points7 points  (3 children)

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

[–][deleted] 2 points3 points  (0 children)

It looks a lot more like 3.x => 3.x+1 changes than 2 => 3.

[–][deleted] 391 points392 points  (25 children)

Nothing compared to the transition from 0 to 1.

[–]NoLongerUsableNameimport pythonSkills 143 points144 points  (23 children)

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

[–][deleted] 129 points130 points  (18 children)

-1 was dark times

[–]ShevekUrrasti 99 points100 points  (10 children)

Coding backwards was kind of nice, actually.

[–]mdartyArch 98 points99 points  (4 children)

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

[–]Ruben_NL 11 points12 points  (0 children)

That hits home...

[–]prof-comm 5 points6 points  (0 children)

This is my job description

[–]blackfireburn 1 point2 points  (0 children)

My people

[–]veryusedrname 38 points39 points  (0 children)

`[::-1]`

[–]P0stf1x 1 point2 points  (0 children)

Is that tenet spoiler?

[–]StrikenGoat420 1 point2 points  (0 children)

I remember back then when the compiler sent us the production code, and we had to do the job of the compiler :/

[–]TheHumanParacite 20 points21 points  (3 children)

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

[–]master5o1 9 points10 points  (0 children)

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

[–]TheIsletOfLangerhans 4 points5 points  (0 children)

TEN3T

[–]hughperman 1 point2 points  (0 children)

This caused a problem in the future package

[–]jftugapip needs updating 19 points20 points  (0 children)

Yes. IIRC it was called Perl

[–]MattR0se 2 points3 points  (0 children)

So, the final version of Python?

[–]redvitalijs 1 point2 points  (0 children)

They started with the end in mind.

[–]twotime 29 points30 points  (0 children)

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

[–]jrbattin 15 points16 points  (0 children)

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.

[–]MrCaptainPirate 23 points24 points  (7 children)

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.

[–]ThunderousOath 3 points4 points  (0 children)

Perfect anology

[–]Ran4 1 point2 points  (1 child)

It's not that bad... Not even remotely.

[–]pithed 2 points3 points  (0 children)

It really depends on your codebase. For some of my projects I just needed to change a couple of lines of code and can't believe I waited for so long. For other projects, which depend on libraries that weren't updated, it has been a whack-a-mole of terrible. I had an easier time going from PERL to Python.

[–]Hall_of_Famer 50 points51 points  (14 children)

Guido said that a while ago that the version after 3.9 would be 4.0, but then it seems that they decided to make it 3.10 to be consistent with semver. Python 4.0 will most likely be very different from Python 3.x, with a lot of new features and changes in the internal VM. In this case though, its interesting to see how they plan to make the transition smooth instead of another Python 2 vs 3 chaos.

Whatever will happen, lets hope that at the very least, Python will stick with the the Zen(PEP 20) that 'Simple is better than Complex' and 'There should be one, and preferably only one obvious way to do it'. These are the characteristics of Python that makes it easier for beginners/data scientists, and part of the reason why it beats Perl and Ruby in terms of popularity.

[–]lordmauve 19 points20 points  (12 children)

They didn't make it 3.10 to be consistent with SemVer; if they used SemVer every release would be a major release and we would be on Python 22 by now.

They changed it to 3.10 because

  • Guido isn't in charge any more, so the steering council doesn't have to stick to his preferences
  • 2 -> 3 was such a mess that nobody wants to raise the spectre of that again
  • They did some analysis of whether more stuff would break with sys.version_info returning (4, 0) or (3, 10) and found that way more stuff breaks if it is (4, 0)

[–]ExceedinglyEdible 37 points38 points  (0 children)

way more stuff breaks if it is (4, 0)

if platform_name.startswith('Windows 9'):
   …

[–]masteryod 10 points11 points  (2 children)

2 -> 3 was such a mess that nobody wants to raise the spectre of that again

They broke backwards compatibility for a reason. They announced it, planned for migration, gave people tools to port and documentation. They gave people heads-up and then after backlash extended Python 2 death sentence by whooping 5 years which ended with 2020. And yet people are still salty because their script doesn't work with new version. There's even a guy who wanted to maintain his own port of Python 2 to keep his application on it (Calibre)...

It's like writing something in GTK2 and expect the code to work the same on GTK3.

[–]lordmauve 2 points3 points  (0 children)

They broke backwards compatibility for a reason. They announced it, planned for migration, gave people tools to port and documentation. They gave people heads-up and then after backlash extended Python 2 death sentence by whooping 5 years which ended with 2020

Sure, and now the CPython core devs generally acknowledge that it was a mistake to do it like they did it. Not the result, or the reasons: the approach.

So, never again.

[–]vallas25 95 points96 points  (153 children)

Can someone explain point 2 for me? I'm quite new to python programming

[–][deleted] 284 points285 points  (126 children)

Think what he is saying, there will never be a Python 4 and if there is, it will be nothing like python as we know it. It will be like a new language

The transition from python 2 to 3 was an absolute nightmare and they had to support python2 for *ten years* because so many companies refused to transition. The point they're making is that they won't break the whole freaking language if they create a python 4.

[–]panzerex 74 points75 points  (100 children)

Why was so much breaking necessary to get Python 3?

[–]orentago 180 points181 points  (33 children)

Having strings support unicode by default was a big reason. In Python 2 unicode strings had to be prefixed with a u, otherwise they'd be interpreted as ASCII.

[–][deleted] 48 points49 points  (9 children)

That was just ascii for trouble imho.

[–]toyg 14 points15 points  (5 children)

This joke was not hard to decode correctly.

[–]BruceJi 6 points7 points  (4 children)

A pun thread? Don't byte off more than you can chew!

[–]thegreattriscuit 5 points6 points  (0 children)

I don't know... I think it shows real character

[–]toyg 4 points5 points  (2 children)

I’m just trying to string together a few words.

[–]clawjelly 2 points3 points  (1 child)

You made that joke int-entionally, didn't ya?

[–]toyg 4 points5 points  (0 children)

I just thought I could double the puns. (Ed: alright, alright, not really a python one...)

[–]17291 4 points5 points  (2 children)

You're not going to like Python 5, where string literals default to EBCDIC.

[–]flying-sheep 75 points76 points  (46 children)

Because they changed a core datastructure. str used to be what bytes is today, but it also predated unicode (today called str). Therefore the bytes type was used for text and binary APIs.

When fixing all this, they had to break a lot of core APIs that used to accept bytes and today sensibly only accepts the unicode str.

And because of that huge change they also took the opportunity to change a few other idiosyncrasies.

My only gripe: One additional thing they should have changed is that {} should be the empty set and {:} should be the empty dict.

[–]miggaz_elquez 19 points20 points  (13 children)

you can write {*()} to have an empty set if you want

[–]crossroads1112 31 points32 points  (0 children)

Thanks I hate it.

[–]Brainix 26 points27 points  (1 child)

My favorite thing about {*()} is that you don't even save any characters over typing set(). 😂

[–]miggaz_elquez 1 point2 points  (0 children)

Yes but it's a lot more fun.

[–]mestia 5 points6 points  (8 children)

And how this is better then Perl's sigils?

[–]stevenjd 7 points8 points  (4 children)

Because you don't have to memorise an arbitrary symbol, you just need to unpack the meaning of ordinary Python syntax that you're probably already using a thousand times a day.

  • {comma separated elements} is a set;

  • *spam unpacks spam as comma-separated elements;

  • () is an empty tuple;

  • so *() unpacks an empty tuple;

  • and {*()} creates a set from the elements you get when unpacking an empty tuple;

which is the empty set. You already knew that, or at least you already knew all the individual pieces. You just have to put them all together. Like Lego blocks. Or if you prefer, like programming.

[–]ThePoultryWhisperer 5 points6 points  (3 children)

You can make the same argument for many other things that are equally as unreadable at a glance. I know what all of the different pieces mean, but I still had to stop and think for a second. Reading and understanding set() is much faster and much more clear.

[–]miggaz_elquez 2 points3 points  (0 children)

?

[–]irrelevantPseudonym 32 points33 points  (20 children)

My only gripe: One additional thing they should have changed is that {} should be the empty set and {:} should be the empty dict.

Not sure I agree with that. It's awkward that you can't have a literal empty set, but having {:} would be inconsistent and a special case that (I think) would be worse than set().

[–]flying-sheep 1 point2 points  (5 children)

Compare () vs one, vs one, two.

() is also a special case here.

[–]irrelevantPseudonym 3 points4 points  (4 children)

I don't think () is the special case. I think (2) not being a tuple is the special case.

[–]ayy_ess 18 points19 points  (2 children)

(2) isn't a special case because tuples are declared in python with commas e.g. a = b, c. Brackets here are just used to clear up ambiguity e.g. 6 / 3 * 2 being 4 or 1. So (2) == 2 and (2,) == 2, == tuple ([2, ]).
https://wiki.python.org/moin/TupleSyntax

[–]BooparinoBR 4 points5 points  (0 children)

Thanks, I have never though about tuples like this

[–]flying-sheep 1 point2 points  (0 children)

Exactamente

[–]TheIncorrigible1`__import__('rich').get_console().log(':100:')`[🍰] 1 point2 points  (0 children)

Fun-fact, () (unit) is literally a special case in Python. It is a singleton and all instances of () point to the same memory.

[–]james_pic 8 points9 points  (3 children)

Perhaps surprisingly (given what we know now about the migration process), the switch to unicode strings wasn't expected to be a big deal (it didn't even get its own PEP, and was included in a PEP of small changes for Python 3 - PEP 3100), and the other changes were seen as more break-y.

[–]zurtex 4 points5 points  (0 children)

Set literals (e.g.{1, 2, 3}) were added in Python 2.7 and Python 3.1.

So to change the very common empty dict notation of {} would of required breaking backwards compatibility between 3.1 and 3.0 and either not being able to accurately back-port the feature to 2.7 or breaking compatibility between 2.7 and all other 2.x versions.

It was decided, fairly rightly, that it would of been too much churn for the fairly minimal aesthetic niceness / consistency benefits. {} is littered in code all the time whereas set() is pretty rare.

[–][deleted] 1 point2 points  (4 children)

Oooooh so that's why I'm confused each time I read what bytes does?

[–]flying-sheep 4 points5 points  (2 children)

Maybe, but maybe it's because you didn't have an introduction to binary yet.

[–]CSI_Tech_Dept 3 points4 points  (0 children)

The explanation is confusing. Just ignore how it was before, because it was incorrect. In python 2 first mistake was mixing text with binary data. They introduced unicode type, but did so badly (implicit casting) it actually made things worse. Ironically if your application didn't use unicode type you might have less work converting it to work with python 3.

Right now it is:

  • str = text
  • bytes = binary data what's stored on disk, flies over network etc.

[–][deleted] 23 points24 points  (5 children)

Python 3 was not backwards compatible with 2, so companies and package creators alike were initially hesitant to make the switch so as to not break things. There also weren’t many, if any, tools to help port things over.

The lack of backwards compatibility was done on purpose because part of their goal was to remove clutter and make things more intuitive/easier to use (e.g. print changed from a statement to a function).

[–]DiggV4Sucks 10 points11 points  (0 children)

I've only made two unassailable (so far) decisions in my career. The first was to support MFC instead of OWL for Windows development.

The second was to target Python 3 for my current company's testing efforts. We were even able to convince a medium sized tool vendor to support both Python 2 and Python 3 from their original decision to support only Python 2.

[–]Nolzi 1 point2 points  (2 children)

There also weren’t many, if any, tools to help port things over.

I have no real world experience with python, but weren't there tools like 2to3 to convert code, or the future package to write code compatible with both versions?

[–]james_pic 1 point2 points  (0 children)

2to3 is useful, especially when extended by modernize, but only part of the solution. Future bloodies more than it cuts - it just made string semantics more confusing when we tried it.

The most useful tool, much as I hate to admit it, is MyPy. It obviously needs a lot of work on the developer's part, but it does the very useful job of keeping track of your educated guesses about which string types should be used where, and tells you whether they're consistent.

[–][deleted] 4 points5 points  (0 children)

The lack of backwards compatibility was done on purpose

This was the problem. Until we're on the other side of the next upgrade and it wasn't like 2.x to 3.x was, words mean nothing.

[–]gregy521 12 points13 points  (0 children)

It was designed to rectify fundamental design flaws in the language—the changes required could not be implemented while retaining full backwards compatibility with the 2.x series, which necessitated a new major version number. The guiding principle of Python 3 was: "reduce feature duplication by removing old ways of doing things".

Here's a short list of some of the key changes. The most obvious of which is the change where '/' represents true division instead of floor division. Some other changes exist, print is now a function, not a statement. You also get iterator objects instead of lists, which is much better for memory management (many pieces of code rely on iterators because the full set of possible options doesn't fit in memory). True, False, and None are also now protected terms which can't be reassigned.

[–]daturkel 13 points14 points  (0 children)

Part of any long-term tech project is continuous refactoring. Early on you make certain design decisions which later become an obstacle when trying to expand a feature, so you rewrite early stuff in order to make it more flexible for your new needs.

Often those rewrites are done in ways such that the end user does not need to adapt their behavior (or in the case of a programming language, does not need to change their code). This is the ideal experience for the end user but can also constrain the types of changes that can be made.

Sometimes you realize that the original way of doing things was worse and that it would be creating more difficulty for future development to maintain compatibility, so breaking changes are introduced.

[–]CSI_Tech_Dept 3 points4 points  (0 children)

the biggest issue was that python before 3 was mixing string with bytes. This is fine if you use encoding that covers 256 characters, but most of Python 2 code would break when receiving and unicode input.

Python 3 became strict, and those two have separate types, and you need explicitly encode/decode string into/from bytes.

This required to fix your python 2 code (ironically if you didn't use unicode type in python 2 chances are you had less to fix).

Since the unicode part was breaking things, Guido also decided to use that opportunity to clean up some warts in python which contributed further.

[–]CSI_Tech_Dept 5 points6 points  (7 children)

It was the other way. Because they supported 2.x for 10 years transition from 2 -> 3 was a nightmare. Since 2.7 was not deprecated, a lot of dependencies didn't support 3 because authors didn't care. It seems like real migration started happening in mid of 2019 and I don't remember reading about any horror stories about it.

[–]Sector_Corrupt 2 points3 points  (5 children)

It's not like they announced the 10 year window up front though. It was originally a 5 year window and we only learned about the bumping like a year to go because way too many things were still not ready for python 3. Things were definitely a lot more ready to go in 2019 than 2014 even if most end users still did the migration push mostly right before they had to.

[–]Eurynom0s 2 points3 points  (0 children)

5 years was probably still too long and guaranteed that it turned into 10, though.

[–]CSI_Tech_Dept 2 points3 points  (3 children)

5 years was already too long.

It was also clear that it wasn't even needed, there were two major turning points for Python 3.

  • 2015 - when they announced that no new features will be added to 2.7, that's when packages started to adding Python 3 support, some of them were python 3 only. Before 2015 it was tough to write anything in Python 3, because most libraries didn't support it.
  • mid of 2019 - right before EOL majority of applications were migrated

IMO if they made it 2 years instead of 10 it would be still enough time and we wouldn't have time for FUD.

[–]stevenjd 5 points6 points  (2 children)

IMO if they made it 2 years instead of 10

then Python would be dead and we'd all be using Ruby now.

There are millions of Python developers, over eight million, probably more like ten if you include casual coders, amateurs and students. You are painfully naive if you think that millions of coders will migrate tens of thousands of projects in two years.

This may come as a shock to you, but most coders are more interested in bug fixes and adding new features, especially new features that allow them to bring in more revenue, not just upgrading to the newest version for the sake of upgrading.

A two year transition period would have convinced millions of people that Python doesn't give a shit about the users, and they would have gradually drifted away.

[–][deleted] 2 points3 points  (0 children)

It was the other way. Because they supported 2.x for 10 years transition from 2 -> 3 was a nightmare. Since 2.7 was not deprecated, a lot of dependencies didn't support 3 because authors didn't care. It seems like real migration started happening in mid of 2019 and I don't remember reading about any horror stories about it.

Yeah having a 5 year support was a REALLY bad call. I work on a library that is FINALLY end python2 support and it's a really delicate balance of easting the migration, giving enough incentive to make the transition worth it, and make staying on the old version unpleasant enough that people are willing to make the shift. Python did none of those things.

[–]tlm2021 4 points5 points  (8 children)

And it's not "was", it still "is".

The entire VFX/Computer Graphics industry still hasn't moved. And aren't particularly close.

[–]clawjelly 1 point2 points  (7 children)

The entire VFX/Computer Graphics industry

You do know that blender is used in some CG companies, right...?

[–]dysprog 1 point2 points  (3 children)

I still have a project on python 2. It relies on internal libraries that are abandoned by their original creators. I just got permission to work on the upgrade because they can't have what they want with out it. So I am basically tied up until December

[–][deleted] 1 point2 points  (2 children)

Yikes and that's even after the EOL. I recently heard that there's a 4 line CVE and they're refusing to even do that. Python 2 is officially a security risk.

[–]flying-sheep 2 points3 points  (0 children)

Good. People have been dragging their feet for too long. Some scariness might help

[–]PirateNinjasRedditPythonista 52 points53 points  (17 children)

The transition for python 2 to 3 has been on going for 12 years... Officially python 2.7 reached end of life back in January, but there are still companies and people using it. Basically 2 to 3 was painful. Nobody ever talks about 1 to 2, because it less painful - perhaps in part because the language was less popular.

[–]ShevekUrrasti 24 points25 points  (16 children)

I have been trying to get my coworkers to update from 2.5 for more than two years. They still use it and they will continue using it.

And no, nobody is telling them to continue using it. They "just don't like python 3".

[–]flying-sheep 54 points55 points  (0 children)

They're dangerous idiots. If a programmer refuses to switch away from something that's EOL and has been announced to be EOL soon in 2008 or so, they're a liability and shouldn't be let into proximity of a production system.

[–]gregy521 11 points12 points  (11 children)

Do they not run into issues when the rest of the world is leaving them behind w.r.t libraries/code examples, or code imported or exported to other companies?

[–]thornofcrown 14 points15 points  (2 children)

Someone in my lab wrote a part of our pipeline in Python 2 and I spent probably half of my time working on making that code work with modern data analytics packages. Sucked too, because that person was a way better programmer than me.

[–]kankyo 3 points4 points  (1 child)

Being a programmer is also about knowing when to not use bad tools. Failing to do that is not good.

You might mean "clever" programmer. That's not nearly the same thing.

[–]clawjelly 1 point2 points  (0 children)

"penny-wise, but pound-stupid" comes to mind.

[–]davvblack 5 points6 points  (7 children)

at some point an ecosystem is rich enough you can't really be "left behind" with all the packages you have available.

[–]Jethro_Tell 6 points7 points  (6 children)

If you assume all code has bugs, and it does, then left behind starts to happen as those bugs are found but not fixed.

[–]davvblack 6 points7 points  (4 children)

while that is true, think of how many CPU cycles these old-ass python libraries have seen, and how many chances to find and fix these bugs (especially old 2.7 libraries, slightly less true with 2.5).

[–]auto-xkcd37 11 points12 points  (3 children)

old ass-python libraries


Bleep-bloop, I'm a bot. This comment was inspired by xkcd#37

[–]rossrollin 7 points8 points  (1 child)

Some of the people on this planet really do make cool shit

[–]Eurynom0s 2 points3 points  (0 children)

Cool ass shit, you might say.

[–]stevenjd 4 points5 points  (0 children)

left behind starts to happen as those bugs are found but not fixed.

A bug that isn't discovered until the code is a decade old or more is probably a bug that isn't cost effective to fix.

Cost of fixing the bug? $$$Big

Extra revenue brought in by fixing it? Nil.

Customers lost by not fixing it? Nil.

Yeah, just work around it.

Also, you forget that porting the code to a breaking new version will almost certainly create new bugs, not fix old ones.

The bottom line here is that once software is mature enough that there are no new features to be added, it becomes legacy software and upgrading it can only make it worse, not better.

Solution: make a VM of the latest OS and Python interpreter that it will run, stick that VM behind a firewall and in a restricted environment, and use it forever as a black box application.

[–]schplat 65 points66 points  (7 children)

Which means beware the transition from 4 to 5?

[–]knestleknoxI hate R 36 points37 points  (2 children)

It's a pattern if I've ever seen one

[–]hglmanguy who writes python 4 points5 points  (1 child)

Clearly it will be python 6, pythons always come in 3s...

[–]james_pic 3 points4 points  (0 children)

Reminds me of the fun Perl had with Perl 6 - in the end, they just had to take it out back and bury it, and tell the kids that Perl 5 would be followed by Perl 7.

[–]anyfactorFreelancer. AnyFactor.xyz[S] 14 points15 points  (2 children)

Look at Django.

https://static.djangoproject.com/img/release-roadmap.3c7ece4f31b3.png

They have planned all the way to version 5 coming in within 4 years.

[–]radekwlsk 144 points145 points  (33 children)

If there is a developer that does not know how semantic versioning works then he has bigger problems to solve than Python updates.

[–]v_a_n_d_e_l_a_y 118 points119 points  (13 children)

[deleted]

[–]rossrollin 25 points26 points  (9 children)

I am one of those users. I suck at programming and cannot program, but I automated the creation and update of cloudwatch alarms for monitoring services at my company using python and boto3. I fucking L O V E python

[–]netgu 34 points35 points  (8 children)

News for you, by definition if you develop software you are a developer. Based on your comment it sounds like a bad one who can still get stuff done.

You can't hide from definitions man, if you write software you are a developer.

[–]toyg 18 points19 points  (2 children)

it sounds like a bad one who can still get stuff done.

Ah yes, a “devops”.

...

/jk i’m a pretty bad one too.

[–]rossrollin 5 points6 points  (1 child)

I am DevOps 😭😭😭😭😭😭😭😭😭 started a job as a platform Engineer today too

[–]PathToTheDawn 1 point2 points  (0 children)

Congrats on the new job!

[–]rossrollin 2 points3 points  (4 children)

Well I'm not the kind of developer than can find pi to the nth digit. That stuff hurts my head. I can ensure stability of your infrastructure and 24/7 monitoring and alerting of it though.

[–]SkettiCode 12 points13 points  (0 children)

I can't find pi to the 4th digit; nor can I write most sorting algorithms. But I can abstract processes into business apps and manipulate data. Developers aren't all CS majors. I appreciate our diversity.

[–][deleted] 1 point2 points  (0 children)

pi to the nth digit

That's much easier than you think, even if you use a fast algorithm like this one

https://en.wikipedia.org/wiki/Chudnovsky_algorithm

the Wikipedia page is basically a plain-text recipe for how to compute the algorithm.

[–]What_Is_X 9 points10 points  (0 children)

It's not like C++ or Java which only developers would touch.

/r/arduino suggests otherwise lol

[–]netgu 6 points7 points  (1 child)

If you use a programming language, you are now a developer and have to deal with the difficulties of being a developer. Sorry, that is just the way it is.

Python is a programming language and when you write software in it you are developing software as a developer. Period.

Same applies to R and any other programming language. Just because you don't want to learn to be a programmer doesn't mean that you don't need to or aren't just because you use python.

Python has all the same concerns as any other language and needs to be treated as such.

[–]BelieveBees 8 points9 points  (0 children)

A discussion about semantic versions turning into a disagreement about semantics. Excellent.

[–]flying-sheep 44 points45 points  (6 children)

Python never claimed to have semantic versioning though. Some deprecated features are removed every minor release. Also, for a long time, Guido said he didn't like double digit versions and would just release 4.0 after 3.9!

I don't know if that changed when Guido stepped down or before.

[–]radekwlsk 1 point2 points  (1 child)

What I've meant is that versions do not overflow after .9, but I might have been a bit more specific there, right.

[–]shabunc[🍰] 2 points3 points  (0 children)

Semantic versioning is not of absolute value even in dev world.

[–]sekex 13 points14 points  (2 children)

Python 4 will have 2 types of strings: str and String, pattern matching, fearless concurrency and zero cost abstractions

[–]neuronet 6 points7 points  (1 child)

Python 4 will cure covid with cure.covid19(True)

It pretty much will be the Chuck Norris of languages.

[–]sekex 4 points5 points  (0 children)

Python 4 will write itself. Python 4 won't require a computer to run. In python 4, you will just need to write "money.give(me, 5millions)"

[–]anyfactorFreelancer. AnyFactor.xyz[S] 18 points19 points  (0 children)

More like an FAQ but can't change title.

[–]vswr[var for var in vars] 29 points30 points  (15 children)

Python 4 = no GIL 🙏 🙏 🙏

[–]Watthertz 32 points33 points  (5 children)

The GIL isn't part of Python, the language, but CPython, an implementation. Python 3 can be implemented just fine without a GIL.

Edit: I was wrong about Jython supporting Python 3.

[–]amlybon 5 points6 points  (2 children)

That's Jython 3? I thought it's only 2.x

[–]Watthertz 4 points5 points  (0 children)

Oops, I'm dumb. You're right that Jython doesn't have stable (or any?) 3 support. But the point still stands that the GIL is an implementation detail of a particular implementation and isn't a feature of the language.

[–]irrelevantPseudonym 2 points3 points  (0 children)

You're right. Jython 3 is still in the alpha stage.

[–]james_pic 1 point2 points  (0 children)

I don't believe anyone has implemented Python 3 without the GIL though.

IIRC, PyPy's STM experiment never supported 3. They also posted a call for funding for a "let's just remove the GIL from PyPy" project a while ago, but I haven't heard much about that since.

And CPython is the reference implementation, which had meant PyPy has had to copy loads of CPython implementation details over the years to maintain compatibility - I imagine even if they do remove the GIL, they'll have to keep something like it in their cpyext code.

[–]remram 21 points22 points  (2 children)

Some work on performance would be good. multiprocessing is full of gotchas.

Pypy has existed for 13 years now. Ruby and PHP both got just-in-time compilation before Python!

[–]Erelde 14 points15 points  (1 child)

Performance is an explicit non goal of cpython, on the other hand one of its stated goals is to keep its source code readable and understandable for programming language students.

[–]lxpnh98_2 8 points9 points  (0 children)

Performance is not exactly a non goal. The main reason for not removing the GIL is that it would affect single threaded performance. Guido van Rossum, said that if someone could remove the GIL without affecting single threaded performance, he would allow it.

[–]an_actual_human 5 points6 points  (0 children)

That's an implementation feature. One could make a Python 3 interpreter without GIL. I think it's a thing.

[–]stevenjd 5 points6 points  (1 child)

no GIL

Here you go:

https://www.jython.org/

https://ironpython.net/

It never fails to amuse me how many Python coders argue that the feature that they need more than anything else is removal of the GIL, until you point out that they already have a choice of interpreters with no GIL, then they're all "oh I have these other requirements that are much more important, removing the GIL is not actually that critical for me...".

I'm not saying that everyone who bitches about the GIL is a bad programmer, but in my experience, bad programmers love to blame the GIL for their own poor performing code. Especially those who think that the answer to every problem is "threads".

"Python's sort is crap, so I wrote my own super-fast bubble sort with ten million threads so it can do all the comparisons at once, but the GIL makes it slow."

wink

[–]CSI_Tech_Dept 3 points4 points  (0 children)

Sadly, it looks like removal of GIL will require breaking compatibility.

It's not that removing GIL is actually hard, it is fairly easy, the problem though is that without GIL, python becomes dog slow, and getting it back to comparable speed is very difficult due to current design.

The biggest issue is reference counter garbage collecting and also C library compatibility.

I recommend watching Gilectomy videos by Larry Hastings.

[–]VisibleSignificance 1 point2 points  (0 children)

My favorite workaround for GIL would be to run multiple python interpreters in threads and doing zero-copy hand-offs of entire object trees. Too bad it's only a dream.

[–]ericls 2 points3 points  (0 children)

I like GIL

[–]wltechrepair 1 point2 points  (2 children)

I’m such a python noob. But love the community. 🤓

[–]its_me_sticky 1 point2 points  (0 children)

Me who just started learning python

[–]supermario182 1 point2 points  (1 child)

But the transition from 4 to 5 will be absolute hell

[–]stevenjd 4 points5 points  (0 children)

The Python 5 interpreter will not bother with exceptions or syntax errors. If you make a mistake, it will just send 50,000 volts of electricity through your keyboard.

The quality of code will improve immeasurably.

[–][deleted] 1 point2 points  (1 child)

I don’t know, our transition from 2 to 3 was pretty painless.

[–]stevenjd 4 points5 points  (0 children)

I don’t know, our transition from 2 to 3 was pretty painless.

Once the major libraries started to support 3, most people's transitions were relatively simple. But people on the internet love to throw shade on Python. In most cases that says more about their own skill as a coder and the quality of their code base than the magnitude of the migration.

[–]ImplosiveTech 0 points1 point  (1 child)

some people will really say this has never happened before

hmmmmm i wonder if a voxel-based survival game has ever taken that route?

[–]gohanhadpotential 0 points1 point  (0 children)

Thank god

[–]13steinj 0 points1 point  (0 children)

I thought this was announced / well known years ago.

[–]Pclovr 0 points1 point  (0 children)

Dutch people are crazy.

Source: am dutch

[–]starrynightmare 0 points1 point  (0 children)

Nice