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

Collin Winter collinw at gmail.com
Tue Aug 15 22:13:19 CEST 2006


On 8/15/06, Paul Prescod <paul at prescod.net> wrote:
> On 8/15/06, Collin Winter <collinw at gmail.com> wrote:
> > How is
> > this significantly better than my dict-based approach, which uses
> > standardised dict keys to indicate the kind of metadata?
>
> The dict-based approach introduces an extra namespace to manage. What if two
> different groups start fighting over the keyword "type" or "doc" or "lock"?

How do you foresee this arising? Do you think users will start wanting
to apply several different typechecking systems to the same function?

The idea behind these standard keys is to a) keep them limited in
number, and b) keep them limited in scope. At the moment, I can only
foresee two of these: "type" and "doc". My justification for "type" is
that users won't be using multiple type systems on the same parameter
(and if they are, that their own problem); for "doc" is that a
docstring is just a Python string, and there's really only own way to
look at that within the scope of documentation strings.

Beyond these applications, the annotation consumers are on their own.
Consumers that operate in the same domain may well coordinate their
keys, and popular keys might make it into the list of standard keys
(like the process for getting a module into the stdlib).

I hope to have a second draft of the pre-PEP within a few days that
includes this idea.

Collin Winter


More information about the Python-3000 mailing list