[issue39481] Implement PEP 585 (Type Hinting Generics In Standard Collections)

Serhiy Storchaka report at bugs.python.org
Mon Apr 13 05:12:29 EDT 2020


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

I tested the following example:

import ipaddress, mmap

x: ipaddress.IPv4Network[int]
y: mmap.mmap[int]

MyPy produces errors:

t.py:4: error: "IPv4Network" expects no type arguments, but 1 given
t.py:5: error: "mmap" expects no type arguments, but 1 given

This is because mmap and IPv4Network are not generic types in typeshed. _BaseNetwork and _mmap are generic types, but IPv4Network and mmap are normal classes. The former are implementation detail of typeshed. _mmap does not exist in the stdlib, and _BaseNetwork in typeshed and the stdlib are different things.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39481>
_______________________________________


More information about the Python-bugs-list mailing list