News for hackers. Stuff that matters.
Re:Faster CPython 3.12 Plan by simonw on Monday September 19, 2022 @09:47PM (#32906658)
> Along those same lines, we will initially restrict the types that may be passed through channels to the following:

> * None

> * bytes

> * str

> * int

> * channels

> Limiting the initial shareable types is a practical matter, reducing the potential complexity of the initial implementation.

That's a really interesting detail - presumably channels can be passed so you can do callbacks ("reply on this other channel").

I wonder why floats aren't on that list? I know they're more complex than ints, but I would expect they would still end up with a relatively simple binary representation.

Re:Faster CPython 3.12 Plan by galonk on Monday September 19, 2022 @09:58PM (#32906728)
I don’t know why floats aren’t included, but any float can be easily represented by an int with same bits, or a bytestring, using the struct module to convert between them, so there are clear workarounds.
Re:Faster CPython 3.12 Plan by tylercrompton on Tuesday September 20, 2022 @12:47AM (#32907764)
Fun fact, floats are easier than `int` because `float` has a predictable size.
Re:Faster CPython 3.12 Plan by JoshTriplett on Tuesday September 20, 2022 @09:29AM (#32911403)
> That's a really interesting detail - presumably channels can be passed so you can do callbacks ("reply on this other channel").

Callbacks or notifications, yes. I use both patterns quite often.

Re:Faster CPython 3.12 Plan by saagarjha on Monday September 19, 2022 @10:06PM (#32906788)
Sounds like an oversight…
Re:Faster CPython 3.12 Plan by nine_k on Tuesday September 20, 2022 @12:46AM (#32907754)
Passing channels over other channels used to be a reasonably standard trick in Go, IIRC.