Live data from Hacker News

Python 3.12

python.org

21–30 of 344 posts

Re: Python 3.12

#21
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 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.

Re: Python 3.12

#23

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?

JavaScript has this with template strings. I use it often:

    s = `something ${cond ? `(${v})` : ''} something`

Re: Python 3.12

#24
Breaking changes:

PEP 632: Remove the distutils package. See the migration guide for advice replacing the APIs it provided. The third-party Setuptools package continues to provide distutils, if you still require it in Python 3.12 and beyond.

gh-95299: Do not pre-install setuptools in virtual environments created with venv. This means that distutils, setuptools, pkg_resources, and easy_install will no longer available by default; to access these run pip install setuptools in the activated virtual environment.

The asynchat, asyncore, and imp modules have been removed, along with several unittest.TestCase method aliases.

Re: Python 3.12

#25

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?

js can do it

  $ node
  > `${`${`${1+1}`}`}`
  '2'

Re: Python 3.12

#27

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?

Parse it recursively.

Re: Python 3.12

#28

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?

This has always worked in a Javascript.

  > `${`${`${`${`${1 + 1}`}`}`}`}`
  '2'
It was simply a limitation with the Python parser.

Heck, it even works in Vimscript

  :echo $'{$'{$'{1 + 1}'}'}'
  2

Re: Python 3.12

#30

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?

Is it uncommon? Ruby does it in a fairly syntactically similar way:

    "Hello, it's #{"#{Time.now}"}"
    => "Hello, it's 2023-10-02 09:41:40 -0400"
Post reply on HN