Ken Jin <kenjin4...@gmail.com> added the comment:

Lars, yes you're right that __name__ is documented in datamodel, sorry I wasn't 
clear in my original message. What I meant was that specifically for the typing 
module, it's not exposed anywhere in its docs 
https://docs.python.org/3/library/typing.html.

> If I were to suggest an improvement, it would be that all classes and types 
> (or minimally the abc’s) would have a __name__ attribute, being the name 
> under which it can be imported. 

I think this makes sense. It should be as simple as adding self.__name__ = name 
or some variant. Note that some types hack their names, such as TypeVar or 
ParamSpec. So it's not always that __name__ ​== type/class name.

> Also that the abc’s in typing and collections are as similar as possible.
We strive towards this but it's difficult to get it 100%. The abcs in typing 
are implemented in pure Python and alias the ones in collections, while the 
ones in collections are sometimes tied to C. AFAIK, most types in typing only 
do what the PEPs promise. I hope you understand.

----------

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

Reply via email to