On Thu, Oct 27, 2022 at 1:08 AM Sebastian Rittau <srittau@rittau.biz> wrote:
Speaking with my typeshed maintainer hat: If we are removing that promotion, we need a transition strategy. Here's my suggestion for typeshed:
  1. Introduce a TypeAlias `_typeshed.OldBytes = bytes | bytearray | memoryview` (or similar).
  2. Document that `OldBytes` must not be used manually.
  3. Programmatically replace all occurrences of "bytes" in argument types with `OldBytes`. (We can only do this for third-party stubs once all typecheckers include `_typeshed.OldBytes`. This should ideally happen, *before* typecheckers remove support for the automatic promotion.)
  4. Check all occurrences of `OldBytes` manually and replace them with the appropriate types. This can be done over time when touching a particular stub file anyway.
  5. Eventually (in a few years) remove `_typeshed.OldBytes`.

Sounds like a good transition plan.

If it's for internal use only, why not name it `_typeshed._OldBytes`?

And what would be lost if even that dropped `memoryview`? (Probably the world would explode, never change something that's deprecated anyway no matter how much you want to. :-)
 
--
--Guido van Rossum (python.org/~guido)