(tl;dr: None of this is related to the thread's topic, and there's no need for alarm.) On Wed, Dec 22, 2021 at 9:06 PM Gregory P. Smith <greg@krypto.org> wrote:
As a side note, Awaitable is available from the typing module where typing
users are already importing a pile from, as well as collections.abc. But they appear to be different things. Eek. `typing.Awaitable` vs `<class 'collections.abc.Awaitable'>`.
Really? They look closely related to me. What strikes you as different?
I just did a quick repr check. They're clearly not a reference to the same thing.
If I went and looked at the implementation I'm assuming they're ultimately the same thing for typing purposes? I just found it odd about the comment earlier about needing to import collections.abc for Awaitable. At first glance that doesn't appear necessary.
For historical reasons all things in typing that correspond to things in collections.abc (Mapping, Iterable, etc.) are all slightly different than the thing they try to resemble -- the versions in collections.abc were traditionally not generic (i.e. couldn't be subscripted), PEP 585 changed that (it has a full list of things affected) but for backwards compatibility they're not 100% equivalent at runtime. (Also, note the irregularity for [Abstract]Set in PEP 585.) Once you no longer need backwards compatibility with Python < 3.9, you *should* replace typing.XXX with collections.abc.XXX though, and fix whatever issues crop up -- I wouldn't know what would, but things that depend on typing internals might be affected. This is one reason we need to wait a long time before even deprecating these things. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>