Live data from Hacker News

Python 3.12

python.org

41–50 of 344 posts

Re: Python 3.12

#41

As now f-strings can contain any valid Python expression inside expression components, it is now possible to nest f-strings arbitrarily: >>> f"{f"{f"{f"{f"{f"{1+1}"}"}"}"}"}" '2' Is anyone aware of the change to the interpreter that allows for this?

Ruby can do this:

> puts “h#{”#{i}”}”

You “just” have to make your parser understand how to have all expressions or whatever inside braces. No idea how the python parser works but think about how you can nest json arbitrarily.

Re: Python 3.12

#42
post #16
post #4

I think the support for isolated sub-interpreters with separate Global Interpreter Locks is the most interesting new feature in python. It is doubtful not the best way to offer some sort of concurrency but still a step closer to maybe one day get rid of GILs.

Too bad there's no Python API available yet :( It's scheduled to be delivered next year if I'm not mistaken. The new syntax for generic types is also a very nice QOL improvement, you can now just do: class MyList[T]: ...

Yes, they say it's scheduled for 3.13. But it seems not confirmed yet (probably still not ready for prime time).

Re: Python 3.12

#43

What's new: https://docs.python.org/dev/whatsnew/3.12.html Summary, sorry for poor formatting, I'm not sure HN can do a list of any kind? New features More flexible f-string parsing, allowing many things previously disallowed (PEP 701). Support for the buffer protocol in Python code (PEP 688). A new debugging/profiling API (PEP 669). Support for isolated subinterpreters with separate Global Interpreter Locks (PEP 684…

What are the advantage of Cython over something like C++ with pybind11 or whatever the equivalent in Rustland?

[deleted]

Re: Python 3.12

#45
post #21

Earlier quoted context omitted.

I despise random politics injections as well, but this is rather tame and very much in line with the ironic spirit of how Python release notes are written. I don't think it's offensive to anybody who doesn't go out of their way to become offended by things.

Would you feel the same way if it were a cutesy poem supporting an opposing view?

[deleted]

Re: Python 3.12

#46

oh cool, multi-line f-strings. With inline comments! f"This is the playlist: {", ".join([ 'Take me back to Eden', # My, my, those eyes like fire 'Alkaline', # Not acid nor alkaline 'Ascensionism' # Take to the broken skies at last ])}"

This probably isn't a good motivating example - my first thought was that this is an overcomplicated way to write

    "This is the playlist: " + ", ".join([
        'Take me back to Eden',  # My, my, those eyes like fire
        'Alkaline',              # Not acid nor alkaline
        'Ascensionism'           # Take to the broken skies at last
    ])
Which is easier to read and exactly as long.

(In fact, without 3.12-compatible syntax highlighting, my first intuition upon reading the first line would be to suspect the code of having a typo.)

Re: Python 3.12

#47
post #21

Earlier quoted context omitted.

I despise random politics injections as well, but this is rather tame and very much in line with the ironic spirit of how Python release notes are written. I don't think it's offensive to anybody who doesn't go out of their way to become offended by things.

Would you feel the same way if it were a cutesy poem supporting an opposing view?

Well it already is. You get to pick which direction you agree with.

Re: Python 3.12

#48
post #5

Everything aside, I enjoyed the "And now for something completely different" part.

I don't think political advocacy belongs in an announcement of a Python version.

I don't think this is a political advocacy. It's just a personal expression about a social issue. I found the way it was written quite thoughtful, actually, which I respect (though I don't like in its entirety).

But I upvoted your comment because I don't think there's a reason for people to downvote your comment.

It's absolutely acceptable that someone dislikes the poem and wants to express it here.

People confuse the purpose of "downvote". It's not for disagreement. Downvoting buries a comment. We shouldn't bury something just because we disagree with it. That's against one of the most basic human freedom value. If it's just a disagreement, reply to it expressing your view.

Re: Python 3.12

#49
post #4

I think the support for isolated sub-interpreters with separate Global Interpreter Locks is the most interesting new feature in python. It is doubtful not the best way to offer some sort of concurrency but still a step closer to maybe one day get rid of GILs.

Since it currently lacks any way to transfer objects between interpreters other than pickling, does it offer any advantage over the multiprocessing module?

Re: Python 3.12

#50
post #12

> PEP 684, a unique per-interpreter GIL We are on the track to remove GIL!

I dunno man, seems like there's more GILs than ever before now you can have one per interpreter. . .
Post reply on HN