Author kj
Recipients Jelle Zijlstra, farcat, gvanrossum, kj, lars2
Date 2021-06-29.14:03:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1624975414.2.0.252797923964.issue44524@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-06-29 14:03:34kjsetrecipients: + kj, gvanrossum, farcat, Jelle Zijlstra, lars2
2021-06-29 14:03:34kjsetmessageid: <1624975414.2.0.252797923964.issue44524@roundup.psfhosted.org>
2021-06-29 14:03:34kjlinkissue44524 messages
2021-06-29 14:03:34kjcreate