back to article And now for something completely different: Python 3.12

Python 3.12, the latest stable release of the Python programming language, was released on Monday, offering developers a handful of new capabilities and the removal of some cruft. The revision arrives almost a year after the previous stable release, Python 3.11. Python has recently been ranked the most popular, second most …

  1. b0llchit Silver badge
    Joke

    I'm holding out for Friday Python 3.13. Rumour has it that it will be written in Snake and strangles the competition when bits come to byte.

    1. Version 1.0 Silver badge
      Joke

      "What the hell difference does it make, Python 3.13, Python 3.12, or FORTRAN? There were good programmers lost on both sides." - A Brendan Behan quote updated just like Python these days.

    2. MontyMole

      You would be better waiting for Pithon 3.14 with support for circular references.

      1. b0llchit Silver badge

        You'll need to wait at least for femto-patch-level 3.14159265358979. Rounding errors error rounding the rounds on error rounding the rounds on error rounding the rounds on error rounding the rounds on error rounding the rounds on error rounding the rounds on error rounding the rounds...

      2. karlkarl Silver badge

        Indeed.

        I find it worrying how so few Python developers know about weakref, so leaks in Python libraries are rampant! If we can sidestep that with a GC, I think the Python ecosystem will actually receive a "memory boost"!

      3. Someone Else Silver badge

        Also in python 3.14, type annotation enforcement at run time (optional, of course, so the heads of 75 million Javascript convertees don't all explode all at once).

        "Oh! the humanity!!"

      4. Dave559

        But in Python 3.14, will the python swallow and eat the pie, or will it be in the pie (perhaps four-and-twenty of them, although that would be a very very big pie)…?

  2. bazza Silver badge

    After all these decades there's still a GIL...

    1. Anonymous Coward
      Anonymous Coward

      The GIL is part of CPython but not Jython or IronPython.

      1. Ferry Michael

        But Jython and IronPython are really ex-Pythons not that Python 2.7 is deceased.

        1. zuckzuckgo

          > are really ex-Pythons ...

          The formal definition of ex-Python: "This Python is no more. It has ceased to be. It's expired and gone to meet its maker. This is a late Python. It's stiff. Bereft of life, it rests in peace. It's rung down the curtain and joined the choir, invisible. This is an ex-Python."

    2. Charlie Clark Silver badge

      The GIL was a design decision that made a lot of sense at the time. And it still makes sense in many cases now. Removing it will happen but it will take time to do it right. Larry Hastings gave an excellent talk on why, why not, and how at PyCon a few years ago.

  3. wrp

    concurrency is not parallelism

    The GIL makes parallelism difficult, but it has no impact on concurrency.

    1. Anonymous Coward
      Anonymous Coward

      Re: concurrency is not parallelism

      As long as you are using *await* and *asyncio.gather* to get the most out of your concurrency, i.e. letting io and remote calls run in parallel when possible, and not introducing needless sequential dependencies.

      1. Charlie Clark Silver badge

        Re: concurrency is not parallelism

        I've been using the red-haired uncle of async: yield from for about a decade.

  4. pidloops

    Now where did all my installed packages go....

  5. sarusa Silver badge
    Devil

    You monster

    > f-strings can now handle multi-line expressions, comments, backslashes, and Unicode escape sequences.

    They can even handle infinitely nested f-strings. Here is the example they proudly give for that:

    .. f"{f"{f"{f"{f"{f"{1+1}"}"}"}"}"}" # (outputs '2').

    I am firmly of the conviction that if you ever use multiply nested f-strings * or worse, multi-line sub-expressions, in your f-string literals so as to make your python code unreadable you are a monster. At that point you might as well just be writing perl for maintainability.

    * There is one non-criminal use for all this, which is programmatic string composition. i.e., your f-string includes a variable which contain another f-string(s), and things get evaluated till there's none left. As long as people stick to this things will be fine. But you know some people will commit horrors just because it's allowed.

    1. Mark Simon

      Re: You monster

      That’s starting to look like an f-ing-string.

    2. Charlie Clark Silver badge

      Re: You monster

      I think the example is given to illustrate the quality of the parser now that the rules have been established.

    3. JBowler

      Re: You monster

      >f-string includes a variable which contain another f-string(s)

      Try:

      bar = "foo"

      f = f"{bar}"

      f

      # 'foo'

      f = "f" + "{bar}"

      def getbar(bar):

      return f"{bar}"

      getbar(f)

      # 'f{bar}'

      (Copy and paste into text editor insert required spaces then copy and paste into a Python 3.12 interpreter/REPL; El Reg does not permit computer code...)

      Probably not what you expected; I've been running 3.12 for a while so I just tried it.

      getbar(f"{bar}")

      'works' but f"{bar}" is resolved *before* the function call (the result is 'foo').

      Now there is always the funarg problem. But while McCarthy maybe didn't realize it was hiding in LISP (I was taught it as the "mapcar" problem, I believe they are the same but don't quote me) I suspect the Python guys know about it. After all they were brave, or stupid, enough to implement lambda expressions. C++ too. Lua just does it too; I much like Lua but haven't checked it for the funarg problem since I hope not to make that mistake.

      Entertaining reading for those still here:

      https://groups.google.com/g/comp.lang.lisp/c/3CkNwKawXos?pli=1

  6. Bitbeisser

    Python is among my least favorite programming languages, regardless what everyone else says.

    The only form of Python that I enjoy is that of (past) British humor...

  7. Anonymous Coward
    Anonymous Coward

    Ternary hell

    Only Python:

    [on_true] if [expression] else [on_false]

    because every other language specifying

    [expression] ? [on_true] : [on_false]

    was so boring?

    Also, Pythons no brackets means no auto format.

    Auto format makes revision control easier to read assuming all participants use the same auto format.

    1. Charlie Clark Silver badge

      Re: Ternary hell

      I think you answer your second question yourself.

      I've never liked ternary expressions and avoid the Python version preferring full boolean evaluation. It's not much more typing but it is more explicit. Ternarys were added to Python because people kept demanding them but I don't think they're frequent in practice. Having read enough nested ternarys in my time, I'm very much against this kind of abbreviation over clarity. YAGNI is a good argument for not introducing something – I'm looking at the "walrus" monstrosity.

      What I think will gain more traction over time is the newish match…case construction. Though this has quite a few quirks and gotchas in it that probably need working out first before it sees wide adoption.

      1. Anonymous Coward
        Anonymous Coward

        Re: Ternary hell

        using spaces as a language block delimiter is just fucking stupid, one slip and your code is garbage and you may not even know why when trying to read it

        1. Charlie Clark Silver badge

          Re: Ternary hell

          In over twenty years of working with Python code I've never found this to be a problem. It happens occasionally and is easy to fix but most editors mean you don't have to think about it.

          The people who complain about whitespace in Python are usually those who've never used it, but find their software stack is often full of Python tools.

      2. Anonymous Coward
        Anonymous Coward

        Re: Ternary hell

        Just read a bit on the "match" feature : The structured "literal pattern matching" is quite different from any other language, so I can see why they didn't call it "switch".

        Yes that could be useful.

  8. Anonymous Coward
    Anonymous Coward

    only language designed by dipshits

    have they fixed the shitty use of "space" as part of the language problem?

    until then they can stick it up their stupid arses

    1. crg the new one

      Re: only language designed by dipshits

      Exactly! And still, it's the most popular, which tells you a lot about the average developer. Which then, in turn, should tell you a lot about the average software solution the average developer creates. Yes, total dipshit.

    2. Anonymous Coward
      Anonymous Coward

      Re: only language designed by dipshits

      I agree that "space" problem is awful. However, I would use Python again if it was required by a project I wanted to work on - and I would enjoy it despite the ugly parts. That's life.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Other stories you might like