Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #108627
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Distinction between “class” and “type” |
| Date | 2016-05-13 18:28 -0400 |
| Message-ID | <mailman.655.1463178496.32212.python-list@python.org> (permalink) |
| References | <85eg96eebr.fsf@benfinney.id.au> <nh5kdm$gma$1@ger.gmane.org> |
On 5/13/2016 1:07 AM, Ben Finney wrote: > Howdy all, > > Ever since Python's much-celebrated Grand Unification of classes and > types, I have used those terms interchangeably: every class is a type, > and every type is a class. > > That may be an unwise conflation. With the recent rise of optional type > annotation in Python 3, more people are speaking about the important > distinction between a class and a type. > > This recent message from GvR, discussing a relevant PEP, advocates > keeping them separate: > > PEP 484 […] tries to make a clear terminological between classes > (the things you have at runtime) and types (the things that type > checkers care about). > > There's a big overlap because most classes are also types -- but not > the other way around! E.g. Any is a type but not a class (you can > neither inherit from Any nor instantiate it), and the same is true > for unions and type variables. […] > > <URL:https://mail.python.org/pipermail/python-ideas/2016-May/040237.html> > > As a Bear of Little Brain, this leaves me clueless. What is the > distinction Guido alludes to, and how are Python classes not also types? I suspect that one could produce a class that is not a type, in Guido's meaning, with a metaclass that is not a subclass of the type class. I don't otherwise know what Guido might have meant. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Distinction between “class” and “type” Terry Reedy <tjreedy@udel.edu> - 2016-05-13 18:28 -0400 Re: Distinction between “class” and “type” Paul Rubin <no.email@nospam.invalid> - 2016-05-13 16:06 -0700
csiph-web