Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #108627

Re: Distinction between “class” and “type”

Path csiph.com!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail
From Terry Reedy <tjreedy@udel.edu>
Newsgroups comp.lang.python
Subject Re: Distinction between “class” and “type”
Date Fri, 13 May 2016 18:28:05 -0400
Lines 41
Message-ID <mailman.655.1463178496.32212.python-list@python.org> (permalink)
References <85eg96eebr.fsf@benfinney.id.au> <nh5kdm$gma$1@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de 86KcvLToShzO0jjU1RUZbg9zjdvQpEb5dY2Y+V+tS0dQ==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'guido': 0.05; 'tries': 0.05; 'url:pipermail': 0.05; 'type,': 0.07; 'optional': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subclass': 0.09; 'python': 0.10; 'jan': 0.11; 'around!': 0.16; 'distinction': 0.16; "guido's": 0.16; 'instantiate': 0.16; 'metaclass': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'subject:between': 0.16; 'unions': 0.16; 'unwise': 0.16; 'wrote:': 0.16; 'all,': 0.20; '(the': 0.22; 'variables.': 0.22; 'am,': 0.23; '(you': 0.23; "python's": 0.23; 'header:In- Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'pep': 0.29; 'classes': 0.30; 'class.': 0.30; 'e.g.': 0.30; 'class': 0.33; 'url:python': 0.33; 'could': 0.35; 'clear': 0.35; 'but': 0.36; 'url:org': 0.36; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'things': 0.38; 'url:mail': 0.40; 'to:addr:python.org': 0.40; 'ever': 0.60; 'care': 0.60; 'received:96': 0.63; 'more': 0.63; 'to,': 0.63; 'between': 0.65; 'inherit': 0.66; 'subjectcharset:utf-8': 0.71; 'brain,': 0.84; 'received:fios.verizon.net': 0.91
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host pool-96-227-207-81.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0
In-Reply-To <85eg96eebr.fsf@benfinney.id.au>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <nh5kdm$gma$1@ger.gmane.org>
X-Mailman-Original-References <85eg96eebr.fsf@benfinney.id.au>
Xref csiph.com comp.lang.python:108627

Show key headers only | View raw


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 | NextNext in thread | Find similar | Unroll thread


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