Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #108627 > unrolled thread
| Started by | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| First post | 2016-05-13 18:28 -0400 |
| Last post | 2016-05-13 16:06 -0700 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
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
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2016-05-13 18:28 -0400 |
| Subject | Re: Distinction between “class” and “type” |
| Message-ID | <mailman.655.1463178496.32212.python-list@python.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
[toc] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2016-05-13 16:06 -0700 |
| Message-ID | <87r3d536dg.fsf@jester.gateway.pace.com> |
| In reply to | #108627 |
Terry Reedy <tjreedy@udel.edu> writes: > 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. I think meant that if X is a class, then X is (usually) also a type; but the reverse is not true. We used to think of type and class as the same thing in practice. We didn't have to concern ourselves about too much about theoretical or pedantic differences that might exist. Now with PEP 484, the situation where X is a type but not a class is significant enough in practice that we have to be more careful about the distinction than we were in the Python 2 era. There may(?) also be situations where X is a class but not a type, but I don't think that's being considered as important as the other direction.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web