On Tue, 25 Feb 2020 at 15:19, Ethan Smith <ethan@ethanhs.me> wrote:
The discussion on the name change came from Łukasz https://github.com/python/cpython/pull/18239#discussion_r380996908
I suggested "GenericType" to be in line with other things in types.py.
Quoting Łukasz question: "I know it's late for this bikeshedding but I was always a bit puzzled by the name "GenericAlias". What is it aliasing?" The "GenericAlias" name seemed appropriate to me as these aren't real types - they're aliases for the corresponding container type with some extra metadata attached. So "list[str]" is *mostly* just a different way of writing "list" at runtime - it's primarily typecheckers that will treat it differently (while the runtime typechecking machinery will reject it as too specific to be checked non-destructively). "GenericAliasForAConcreteContainerType" would be excessively wordy though, hence "GenericAlias". By contrast, I'd expect something called "GenericType" to actually be able to do full runtime typechecking and enforcement (e.g. having instances throw TypeError if you tried to insert a value of the wrong type). Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia