On Tue, 25 Feb 2020 at 15:19, Ethan Smith <et...@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   |   ncogh...@gmail.com   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/RB3DOICJURSPGMNYLJDGTPZO3MZ3EVKN/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to