Steven Silvester <steven.silves...@gmail.com> added the comment:

The use case that prompted https://github.com/python/cpython/pull/31679 is that 
we are adding typings to `PyMongo`.  We are late to using typings,  because we 
only recently dropped Python 2.7 support.  

We have an existing options class that subclasses `NamedTuple`.  We would like 
to make that class `Generic`, but are currently blocked.  

Our current workaround is to create a separate stub file that uses `class 
CodecOptions(Tuple, Generic[T])` and explicitly re-declares the `NamedTuple` 
API.

Switching to `dataclass` would be disruptive, since we still support Python 3.6 
and only rely on the standard library.  We would also require a major version 
update since it would be an API change.

----------
nosy: +Steven Silvester

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43923>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to