[Python-Dev] Status of PEP 484 and the typing module

Guido van Rossum guido at python.org
Fri May 22 19:32:37 CEST 2015


On Fri, May 22, 2015 at 10:23 AM, Jim J. Jewett <jimjjewett at gmail.com>
wrote:

>
>
> At Thu May 21 22:27:50 CEST 2015, Guido wrote:
>
> > I want to encourage users to think about annotations as types,
> > and for most users the distinction between type and class is
> > too subtle,
>
> So what is the distinction that you are trying to make?
>
> That a type refers to a variable (name), and a class refers to a
> piece of data (object) that might be bound to that name?
>

Sort of. But really a type is something in the mind of the type checker (or
the programmer) while the class is a concept that can be inspected at
runtime.


> Whatever the intended distinction is, please be explicit in the
> PEP, even if you decide to paper it over in normal code.  For
> example, the above distinction would help to explain why the
> typing types can't be directly instantiated, since they aren't
> meant to refer to specific data. (They can still be used as
> superclasses because practicality beats purity, and using them
> as a marker base class is practical.)
>

There will have to be documentation and tutorials beyond the PEP. The PEP
mostly defines a standard to be used by people implementing type checkers.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150522/bb89fa79/attachment.html>


More information about the Python-Dev mailing list