News for hackers. Stuff that matters.
Re:Python 3.12 by dandiep on Monday October 02, 2023 @10:11AM (#37738392)
Ooh, seems there is a new syntax for declaring the types of kwargs [1]:

  from typing import TypedDict, Unpack
  
  class Movie(TypedDict):
    name: str
    year: int

  def foo(*kwargs: Unpack[Movie]): ...
Maybe now I'll be able to actually figure out what data to send libraries without actually reading their source code.

1. https://docs.python.org/3.12/whatsnew/3.12.html#pep-692-usin...

Re:Python 3.12 by appplication on Monday October 02, 2023 @10:32AM (#37738653)
> Maybe now I'll be able to actually figure out what data to send libraries without actually reading their source code.

One could hope, but any library abusing kwargs in all their methods is showing they’re willing to go through the absolute minimum to make their code usable, let alone readable and self-documenting.

Re:Python 3.12 by Earwig on Monday October 02, 2023 @10:51AM (#37738890)
This is excellent for adding typing to libraries originally designed without it in mind while keeping backwards compatibility.
Re:Python 3.12 by rollcat on Monday October 02, 2023 @10:55AM (#37738953)
It feels like we're going in cycles. C was somewhat lax with type checking, thus C++ and Java were both made more strict. Looking to escape the tyranny of static typing, the rise of Python, Ruby, or JavaScript instead left us with a desire that Rust, Go, and TypeScript now fulfill. I wonder what's the next step? LLMs are extremely broad in what they accept, but don't exactly fill the same niches.
Re:Python 3.12 by tomrod on Monday October 02, 2023 @11:37AM (#37739498)
I'm holding out hope for a Fortran resurgence.

It's a tiny hope. But a hope nonetheless. Fortran is fun.

Re:Python 3.12 by haneefmubarak on Monday October 02, 2023 @11:57AM (#37739825)
I'm curious - what do you particularly like about Fortran that isn't otherwise broadly available? Is it a matter of cultural idioms, a unique composition of features, or something else entirely?
Re:Python 3.12 by f1shy on Monday October 02, 2023 @12:50PM (#37740830)
Not OP, but I know a good use case: where I work we do lots of math and signal processing. It is done in matlab, which is great, but then we need to run it in some embedded processor. Using the C++ generated by matlab is beyond any hope. Had the code be written in Fortran (which is very possible, and would make the code clearer) it would run very fast. Now we had a team of people translating matlab to C++
Re:Python 3.12 by haneefmubarak on Monday October 02, 2023 @12:59PM (#37740984)
I know that Fortran is highly used in the numeric world, especially due to widespread libraries such as LAPACK and BLAS, amongst others; in your opinion, what are the characteristics that make such code much more clear when written in Fortran as opposed to C or C++?

Also, do you prefer a specific version of Fortran, or is the latest one fine?

Re:Python 3.12 by f1shy on Monday October 02, 2023 @01:03PM (#37741064)
It is not about the language. Is about the people using it. They are typically not CS people. You cannot expect they program all the languages. They know typically python, matlab, and fortran. Of the 3, the one that would perform better is Fortran.
Re:Python 3.12 by targafarian on Monday October 02, 2023 @04:01PM (#37743670)
A couple big things: Fortran natively performs operations on arrays directly like Matlab or Numpy in Python (Matlab was originally a REPL-style front-end to Fortan), and Fortran compilers tend to yield quite fast code (though specific cases will have another language outperform Fortran).

You can read more about the language and its high-level features here: https://fortran-lang.org

That website/community was created in part by the original author of the Python Sympy library, Ondřej Čertík. He is also working on his own Fortran compiler that you can use via webassembly to play around with Fortran; find links if you want to play here: https://lfortran.org

I've only dabbled a little, but I like the general idea, and I appreciate a F/OSS Fortran compiler being developed like this alongside actively seeking to grow the Fortran community & push the language & its libraries forward.

I expect more widespread adoption of Fortran to be quite a ways out, but what Ondřej is doing for Fortran is necessary (not sufficient) for such adoption to be the case.

Re:Python 3.12 by teleforce on Monday October 02, 2023 @03:47PM (#37743484)
Check out D language, it should be suitable for math, signal processing, data science, embedded, etc, and it's intended to be better than Fortran, C and C++ [1].

[1] Is Fortran easier to optimize than C for heavy calculations?

https://news.ycombinator.com/item?id=37606477

Re:Python 3.12 by 4m1rk on Wednesday October 04, 2023 @01:27AM (#37761134)
Can you give an example? I'm always curious what could be more readable than calling a few functions and composing them using properly named variables.
Re:Python 3.12 by drbaba on Tuesday October 03, 2023 @07:29AM (#37750429)
Modern Fortran (2008+) has built-in support for matrices, complex numbers, co-arrays (parallel programming), array slicing, etc. This makes it easy to write performant compiled code if you mostly deal with numerics.

Fortran has also added support for e.g. object-oriented programming, pure functions (no side effects for better optimization), and pointers. So idiomatic modern Fortran code looks very different from the “Fortran 77” code that many people might think of when they hear the name :).

Re:Python 3.12 by f1shy on Monday October 02, 2023 @12:44PM (#37740768)
I would really like to see more fortran.
Re:Python 3.12 by jules22 on Monday October 02, 2023 @03:25PM (#37743163)
What does a modern Fortran bring that Julia does not? Small binaries?
Re:Python 3.12 by xmcqdpt2 on Monday October 02, 2023 @06:41PM (#37745431)
Language stability, and easy C ABI for embedding into other programs. Julia isn't really a language for embedding afaik.
Re:Python 3.12 by jules22 on Tuesday October 03, 2023 @03:50AM (#37749021)
Sure, not in the traditional sense. Since it does not make small standalone libraries, even though possible, I would not make a native extension with it. But juliacall works fine for Python and R. Quite seamless.
Re:Python 3.12 by za3faran on Monday October 02, 2023 @12:40PM (#37740699)
golang isn't in the same league as the other languages mentioned. And Java and C# have come a long way since to be expressive as well as lesser syntax heavy (type inference, records, pattern matching, string templates, etc.)
Re:Python 3.12 by f1shy on Monday October 02, 2023 @12:43PM (#37740753)
I always saw C++ and Java addressing other issues, like low level memory management, and higher level abstractions like objects. Not so much type policy. Anyways I see a strong tendency in lots of programmers dismissing anything that is not type static-strict-safe, and others advocating for a more relaxed system.
Re:Python 3.12 by nurettin on Tuesday October 03, 2023 @12:55AM (#37748116)
I see C++ as a scientific DSL definition language. It lets you create an abstraction and define arithmetic operators, iterators and even lets you control dereference and call semantics. The standard helps this scheme by defining the return value optimization.
Re:Python 3.12 by fiedzia on Monday October 02, 2023 @02:19PM (#37742269)
Python is very strict about type checking, it just does it at runtime.

The next step is Idris, where you define starting and desired type and start interactive shell to figure out right way to get there.

Re:Python 3.12 by jules22 on Monday October 02, 2023 @03:24PM (#37743149)
Nim/Julia, IMO.

However....

Nim is unlikely to go mainstream. It's not the next Rust and not for technical reasons.

Julia won't budge Python out of the top slot anytime soon, although it should in many scenarios past simple scripting.

Re:Python 3.12 by diarrhea on Monday October 02, 2023 @10:58AM (#37738982)
It’s like pointer chasing, except the docs having you chase around kwargs are incomplete and there’s gaps. You have to read source code.

The Azure SDK is full of them, making liberal use of kwargs.pop. What a nightmare.

Re:Python 3.12 by mrweasel on Monday October 02, 2023 @12:46PM (#37740786)
The Azure SDK generally have a lot of silliness in the Python implementation. Functions that take string as inputs, except of course they don't, they take two or three very specific string values and use them to control functionality. What those values are... Well, you should take a look at the ENUM in the C# implementation to figure that part out.
Re:Python 3.12 by MrBuddyCasino on Monday October 02, 2023 @03:37PM (#37743323)
Relieved to learn its not just the Java libs that are piles of hastily cobbled-together crap.
Re:Python 3.12 by vorticalbox on Monday October 02, 2023 @04:04PM (#37743700)
Python has enums though :(
Re:Python 3.12 by mrweasel on Tuesday October 03, 2023 @02:38AM (#37748606)
Sure, but Microsoft doesn't always use them.
Re:Python 3.12 by gen220 on Monday October 02, 2023 @03:38PM (#37743349)
`kwargs.pop`, what a phrase – it's amazing how the right arrangement of syllables can make your brain shudder. (:
Re:Python 3.12 by b33j0r on Monday October 02, 2023 @03:56PM (#37743611)
Well, who hasn’t used that classic datastructure `dictstack` (and famously the dict.pop operation)?

At first I was kinda giggling. But actually there are such things, if the Mapping is also ordered.

LRU cache, trees, tries… and—oh wait—all CPython dicts are ordered these days!

(Honestly I have only used the modern ordered-nature of `dict` for serialization to versioned or human-editable files. But why not an algorithm with a “`stackdict`” I guess?)

Re:Python 3.12 by masklinn on Monday October 02, 2023 @11:37AM (#37739510)
A big use case for kwargs is not breaking compatibility and not having to copy/paste a ton of parameters when just forwarding them. But that's exactly the case which is difficult to type correctly.
Re:Python 3.12 by appplication on Monday October 02, 2023 @12:16PM (#37740201)
Either copy/paste or rolling them into config objects and passing those down is generally preferable. Copy paste doesn’t always feel great for pass through arguments but it’s perfectly interpretable.

Naked kwargs is so difficult to work with that I hesitate to think of a use case where it wouldn’t be an anti pattern.

Re:Python 3.12 by memco on Monday October 02, 2023 @12:49PM (#37740828)
> Either copy/paste or rolling them into config objects and passing those down is generally preferable

Preferable for whom? I do not prefer it. I much prefer to avoid the extra work it creates for me vs. the simplicity of kwargs. I use explicit args for the function I made and then add *kwargs on the end and then I don't have to write bespoke config objects or copy and paste a bunch of stuff that might be obsolete by a future update to some library and also pollute my function's signature. I would very much welcome a way to tell callers where kwargs is going without having to do extra work.

Re:Python 3.12 by appplication on Monday October 02, 2023 @01:06PM (#37741113)
Preferable for those who would use your code. If it’s just you then it’s your exclusive preference. If you have users, args/kwargs is going to be more opaque than a more explicit option.

For code with many users, creating a few extra minutes of work for one dev is preferable when the alternative would be every dev who uses that code has to spend that same extra work and then some to grok what exactly is going on with the method signatures. Being explicit also creates traceable code, in that you can search a keyword to find everywhere it’s used or passed rather than tracing methods where it might be used.

I can promise very few users would be thankful for the elegance and minimalism of args/kwargs when they’re source-diving trying to figure out how to get some basic functionality to work.

Re:Python 3.12 by paiute on Monday October 02, 2023 @02:36PM (#37742502)
I think people kind of miss the idea of kwargs in python, the idea is that they are a dict. You can cast a dict to kwargs, in contrast to positional args. I see the typedict being super useful. I really don’t see your argument and would say that this typed dict is more developer friendly than having positional arguments. https://docs.python.org/3/tutorial/controlflow.html#more-on-...
Re:Python 3.12 by memco on Tuesday October 03, 2023 @01:15PM (#37754771)
I haven't often been the designer of code others have used, but I have used someone else's wrappers for libraries that we use in many parts of our code. My experience of trying to use their wrappers has been a guessing game of how they decided to arbitrarily rename an argument and finding places where they don't support arguments that I need. I get that kwargs is a bag of mystery and that there is benefit to being explicit, but it comes with tradeoffs. I don't like really like kwargs, but sometimes the use of kwargs better serves the purpose than the alternatives. I've looked for solutions, but haven't found anything that avoids the above issues. If anyone has tools or techniques that eliminate these pain points please share. The typedDict is promising, but I'm not sure how composable they are. Time will tell.
Re:Python 3.12 by dbrueck on Monday October 02, 2023 @01:41PM (#37741710)
I think naked kwargs can be abused, but there are many legitimate use cases for them. For example, we interface with a message bus that uses JSON for transport. There are several different ways to enqueue a message onto the bus, and it would add a ton of complexity and no real value to define the parameters for each of those Send APIs.

Looking at it another way, the hunk of code in charge of serializing your message does not care one whit about the innards of each message, and making it become aware would add tremendous complexity with no real value.

Re:Python 3.12 by rpcope1 on Monday October 02, 2023 @02:21PM (#37742294)
There's at least a handful of places that you can't escape them, one of the most evident in my mind is when constructing higher order functions or other decorators. Maybe a simple example would be a retry higher order function (or decorator), where you can't know the arguments and their form ahead of time, and want to invoke the wrapped function as is (and only do something like repeating if an exception is triggered). Keyword arguments are helpful for writing certain kinds of generic code, but definitely can be easily abused (much like most of the meta-programming facilities in Python).
Re:Python 3.12 by shrimpx on Monday October 02, 2023 @04:20PM (#37743882)
If you didn't use **kwargs you'd have to copy and paste every kwarg and its default value from the superclass into the subclass, which is ridiculous IMO.
Re:Python 3.12 by bjornasm on Monday October 02, 2023 @06:13PM (#37745168)
caugh fastai caugh
Re:Python 3.12 by vorticalbox on Monday October 02, 2023 @10:15AM (#37738435)
some add what it takes in the DOC string, but even then most don't actually state all the options.
Re:Python 3.12 by diarrhea on Monday October 02, 2023 @11:02AM (#37739031)
Yep, it’s incomplete, and much more importantly not machine readable. These days I want all my code to pass strict mypy. It’s mostly possible and a bliss when it works, but libraries (ab)using kwargs throw a spanner in that. Libraries where everything is kwarg and the docs have to be consulted are a killjoy. And they cause tons of bug from misuse!
Re:Python 3.12 by gv83 on Monday October 02, 2023 @04:35PM (#37744055)
These days you want java then! Why are you not using java?
Re:Python 3.12 by anakaine on Monday October 02, 2023 @05:19PM (#37744552)
Because compared to the ease of use and readability of python you get 1/10th the work done with 5x the pain in the arse.
Re:Python 3.12 by ledauphin on Monday October 02, 2023 @10:45AM (#37738814)
what's especially interesting about this is that it could create a new "meta" for static typing in Python.

One significant issue with static typing in Python is how much boilerplate is required to use types when also doing the sorts of things that dynamic Python is really good at - for instance proxying functions. If you want to do that now and preserve the types, you need to re-declare the types of everything in the wrapper.

Now, if the underlying function already made use of Unpack, you could "reuse" that type in your own wrapper with low boilerplate and less chance of things diverging in hard-to-refactor ways.

Re:Python 3.12 by dagmx on Monday October 02, 2023 @10:55AM (#37738940)
I wonder if Unpack works on a function? I assume it’s any callable.
Re:Python 3.12 by squeaky-clean on Monday October 02, 2023 @12:10PM (#37740088)
The type that gets Unpack[]'d needs to inherit from TypeDict, unless I'm misunderstanding what you mean.
Re:Python 3.12 by dagmx on Monday October 02, 2023 @01:48PM (#37741813)
Basically I was hoping to use it for functions that wrap others.

E.g setup something and then pass the kwargs through to the other function.

Re:Python 3.12 by benkuykendall on Monday October 02, 2023 @09:25PM (#37746763)
If I understand you correctly, I think ParamSpec (since 3.10) is what you are looking for, especially if you want to be generic over the type of the inner function. The example from the docs (https://docs.python.org/3/library/typing.html#typing.ParamSp...):

  from collections.abc import Callable
  from typing import TypeVar, ParamSpec
  import logging
  
  T = TypeVar('T')
  P = ParamSpec('P')
  
  def add_logging(f: Callable[P, T]) -> Callable[P, T]:
      '''A type-safe decorator to add logging to a function.'''
      def inner(*args: P.args, **kwargs: P.kwargs) -> T:
          logging.info(f'{f.__name__} was called')
          return f(*args, **kwargs)
      return inner
  
  @add_logging
  def add_two(x: float, y: float) -> float:
      '''Add two numbers together.'''
      return x + y
Re:Python 3.12 by dagmx on Tuesday October 03, 2023 @11:39AM (#37753343)
Hmm thanks. I think that might be slightly different but I’ll try it out and see.
Re:Python 3.12 by hyperbovine on Monday October 02, 2023 @11:36AM (#37739496)
Surely you mean `**kwargs`
Re:Python 3.12 by winter_blue on Monday October 02, 2023 @11:45AM (#37739621)
> be able to actually figure out what data to send libraries without actually reading their source code

Just reading this sent a chill down my spine. I have horrible memories of having to read the code to figure out what something was doing (in JavaScript, Python, Ruby, etc), due to the disaster of an anti-feature called dynamic typing having been used.

Re:Python 3.12 by seunosewa on Monday October 02, 2023 @11:53AM (#37739766)
But third party code in Python was easy to read.
Re:Python 3.12 by goatlover on Monday October 02, 2023 @01:48PM (#37741820)
It's not an anti-feature. Those languages gained popularity in part because they were dynamically typed. But this debate is decades old and people always dogmatically choose one side, so not really any point in trying to convince you. Alan Kay made the argument back in the 1970s that type systems were always too limiting, therefore classes and late binding were the answer for him.
Re:Python 3.12 by winter_blue on Monday October 02, 2023 @03:51PM (#37743543)
I’m talking from my real-life lived experience with dynamic typing. Dynamic typing is truly harmful for any software projective involving complex logic, or for collaborative team project (where there’s more than 1 person working on the code), or for any large project (even only one person is working on it). It was truly a waste of time to have to read piles of code code, use a debugger and inspect object structure, to understand how some parts of certain large codebases. Dynamic typing is simply horrible for team collaboration, code readability (and ease of understanding), and it results in a large number of bugs that could easily have been eliminated with static type checking.

> so not really any point in trying to convince you

You’re right about that, but I take a stronger position on this than for example something very subjective like curly braces versus white space indentation. I am indeed very dogmatic and take a hard-line on this. To the point that I’ll say this: dynamic typing is simply a wrong and bad engineering decision.

Another example of a bad thing is allowing null to be a part of every type instead of requiring an explicit ? in the type, or the use of an Optional wrapper — and this is something any modern languages — to name a few Rust, Kotlin, etc fixes. But that isn’t meant to level a personal attack against the languages designers of the past (or to say that they were stupid). Allowing every type to be Union[T, null] was a simply a language design mistake (that potentially cost us billions) that we need to rectify and move forward from.

However, imo, dynamic typing is a 100 times worse than not having null safety (or not having memory safety like C or C++). I can work with a C or C++ without much trouble, but not with dynamic typing. Dynamic typing is simply just inexcusably horrid.

Re:Python 3.12 by schrodingerscow on Tuesday October 03, 2023 @11:55AM (#37753574)
Ha you sound exactly like my own consciousness. There are few things in life I feel as resolute about than this one. Dynamic types were a mistake. Let’s learn and move on. I often joke that if null pointer references were the billion dollar mistake (or whatever it’s called), dynamic typing was the 100 billion dollar mistake. And we’re still living with it but thank god for typescript etc for saving us finally
Re:Python 3.12 by winter_blue on Tuesday October 03, 2023 @08:42PM (#37759530)
Thanks. Yeah, I agree.
Re:Python 3.12 by shrimpx on Monday October 02, 2023 @03:56PM (#37743613)
> disaster of an anti-feature

Untyped languages tend to be at the forefront of paradigms, and typed languages come in toward the end when reliability and need for tooling are more important than innovation/discovery.

In the 90s a bunch of kids were building websites with LAMP stacks while serious engineers were building aging/about-to-be-irrelevant desktop software in serious, typed languages.

Re:Python 3.12 by wiseowise on Monday October 02, 2023 @05:27PM (#37744655)
Guess on VM written in which language those LAMP stacks run on?
Re:Python 3.12 by shrimpx on Monday October 02, 2023 @09:49PM (#37746966)
Sure. The “serious” stuff is written in more serious languages and the rapidly changing experimental stuff in more lenient and expressive languages.
Re:Python 3.12 by blacklight on Monday October 02, 2023 @07:05PM (#37745652)
I love Python, but I also love the ability to tell what is what.

I kickstarted a project in Python a decade ago that was wild on dynamic typing. As it passed a critical threshold of ~10k LoC, it became nearly ummaintainable.

What's that `response` passed here? A verbatim response object from `requests`? A proxy mapping? Bytes? A JSON string? If so, a list or a dict? And what fields are inside?

Multiply it by tens or hundreds of methods and classes, and it's easy to see why projects based on purely dynamic patterns fail to scale.

By now I have almost completely rewritten that project to use type hints everywhere I could. And guess what? In 95% of the cases I knew exactly what was being passed - or the choice was about 2-3 types at most, so a Union sufficed.

Yes, there's a 5% of cases where Python's dynamic typing features are a blessing. The power of meta programming in Python is often underestimated. Reflection is amazingly intuitive compared to the patchwork mess of Java, Kotlin and friends. Everything can be mocked without hassle and boilerplate. And duck typing can really be useful sometimes.

But, again, in an average project I wouldn't expect code that benefits from these features to make up more than 5-10% of the codebase.

For everything else, just do yourself, your future self and anyone who will work on your code a favour, and use type hints.

Re:Python 3.12 by shrimpx on Monday October 02, 2023 @09:52PM (#37746982)
I agree. And what makes python a nice choice for this is that you can go wild in the beginning and then gradually add type hints as your project takes shape.
Re:Python 3.12 by winter_blue on Tuesday October 03, 2023 @08:48PM (#37759572)
Statically typed languages in the 90s had a reputation for being verbose (like Java’s Cat = new Cat()), or difficult to work with (like C’s manual memory management). Haskell and other ML family languages hadn’t quite gotten that popular. Type inference wasn’t a feature in many popular statically typed languages until recently. And type inference makes static typing significantly easier.

The P in the LAMP stack is still a bit of a mystery to me. It could (one could wish) have been Haskell instead, but oh well.

Re:Python 3.12 by IshKebab on Monday October 02, 2023 @12:50PM (#37740835)
Finally! I've been waiting for this for years.

Now I just have to wait 5 more years until 3.12 is sufficiently old that work lets me use it.

Bets on user-upgradable Python on Linux by 2030?

Re:Python 3.12 by ptx on Monday October 02, 2023 @01:42PM (#37741727)
Software is always user-upgradable on Linux. Just install it somewhere in your home directory. GNU Stow [0] can be helpful as very lightweight way to manage the packages.

(Of course, then you take on the responsibility of keeping up with patch releases yourself, which is why we use distros. But if it's just a small number of packages on top of a distro-managed base system, it's perhaps not so bad.)

[0] https://www.gnu.org/software/stow/

Re:Python 3.12 by IshKebab on Monday October 02, 2023 @02:24PM (#37742329)
Sure and how do you install Python 3.12 on RHEL 8 without compiling it from source?
Re:Python 3.12 by JodieBenitez on Monday October 02, 2023 @03:01PM (#37742830)
I don't know, but what is the problem with compiling from source ? Some softwares are hard to compile but I found Python really easy to compile.
Re:Python 3.12 by IshKebab on Monday October 02, 2023 @05:22PM (#37744588)
I agree that compiling Python from source is surprisingly straight forward, but is that a serious question?

Have you ever worked in a place that uses Python? When someone says to you "hey it's not working" are you really going to say with a straight face "oh yes, you just need to compile Python from source". Come on, this is one of those obviously stupid situations that for some reason people feel the need to defend. It's not defensible.

You don't need to compile Node or Rust or Go or Deno from source to install the latest version.

Re:Python 3.12 by Cynox on Monday October 02, 2023 @03:06PM (#37742888)
Just run the miniforge install script if you want a very friction-free install. I'm not a big conda fan, but the "install in my home directory" use case is very well covered by miniforge. https://github.com/conda-forge/miniforge/
Re:Python 3.12 by IshKebab on Monday October 02, 2023 @05:23PM (#37744602)
That looks like it will install Conda though?
Re:Python 3.12 by heavyset_go on Monday October 02, 2023 @05:22PM (#37744584)
Use pyenv and let it manage Python versions for you.
Re:Python 3.12 by IshKebab on Monday October 02, 2023 @05:25PM (#37744632)
pyenv builds Python from source.
Re:Python 3.12 by heavyset_go on Monday October 02, 2023 @05:49PM (#37744928)
Yes, but it's automated behind a single command and fast.
Re:Python 3.12 by nurettin on Wednesday October 04, 2023 @12:11AM (#37760774)
Are you really going to support rhel8 as a platform for your project which uses specific python 3.12 rc3 features? Well there's always podman, I guess.
Re:Python 3.12 by dist-epoch on Monday October 02, 2023 @02:36PM (#37742504)
On Ubuntu at least you can install versions of Python separate from the system one.

https://www.cherryservers.com/blog/install-python-on-ubuntu

Re:Python 3.12 by avtar on Monday October 02, 2023 @03:08PM (#37742915)
Using containers is a reasonable workaround:

https://realpython.com/python-versions-docker/#running-pytho...

Re:Python 3.12 by hotnfresh on Monday October 02, 2023 @11:38PM (#37747690)
> Bets on user-upgradable Python on Linux by 2030?

Use asdf. You don’t want to manage your project’s dependencies at the system level any more than you have to.

Re:Python 3.12 by pmeira on Monday October 02, 2023 @12:56PM (#37740944)
Some packages already use those. For previous Python versions, those are available in typing_extensions: https://typing-extensions.readthedocs.io/en/latest/
Re:Python 3.12 by markrages on Monday October 02, 2023 @12:59PM (#37740988)
Modern Python is sure ugly.
Re:Python 3.12 by unstruktured on Monday October 02, 2023 @02:46PM (#37742630)
Unfortunately the typed kwargs are NOT composable :(.