[Python-3000] Conventions for annotation consumers (was: Re: Draft pre-PEP: function annotations)

Paul Prescod paul at prescod.net
Tue Aug 15 21:07:57 CEST 2006


On 8/15/06, Collin Winter <collinw at gmail.com> wrote:
>
> If multiple libraries use the same wrappers, then I can't use more
> than one of these libraries at the same time. If a typechecking
> consumer, a docstring consumer and PyPy all use the same wrapper (or
> "syntax" -- you switch terms between sentences), then I can't have
> typechecking and docstrings on the same functions, and I can't do
> either if I'm running my program with PyPy.


There is a MANY TO MANY relationship between syntaxes (as denoted by
wrappers) and tools that work on those syntaxes.

Think of it by analogy: there are programming languages and there are
interpreters. Some programming languages run on multiple interpreters
(e.gPython on .NET, JVM, PyPy, CPython). Some interpreters run
multiple
languages (e.g. .NET, JVM). Some interpreters run a single language
(CPython).

Or another analogy from my domain: there are a variety of XML syntaxes. Some
are designed for a single program. Others, like Atom, are designed for many,
many programs. Also, some programs can handle a single input format. Others
(like RSS/Atom readers) can consume many.

A Typechecking consumer and a PyPy compiler consumer might work on the same
annotations because they are both interested in TYPES (but doing different
things with them). These type consumers might also choose to implement more
than one type checking syntax, if there were a good reason that more than
one arose (perhaps Unix types versus .NET types).

A docstring consumer and a typechecking consumer would *by definition* use
different syntaxes/frameworks/wrappers because the information that they are
looking for is different! But there could be hundreds of docstring consumers
(as there are today!). Docstrings are a special case because the syntax for
them is fairly obvious (an unadorned string).

 Paul Prescod
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20060815/9fa6ca8b/attachment.html 


More information about the Python-3000 mailing list