[Python-ideas] Conventions for function annotations

Nick Coghlan ncoghlan at gmail.com
Mon Dec 3 12:51:01 CET 2012


On Mon, Dec 3, 2012 at 9:45 PM, Andrew Svetlov <andrew.svetlov at gmail.com>wrote:

> On Mon, Dec 3, 2012 at 1:08 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> > * the advisability of using the __annotations__ dictionary for long-term
> > introspection, rather than using the decorator to move the information
> to a
> > purpose-specific location in a separate function attribute
> My 5 cents: perhaps you don't need to use __annotations__ at all,
> Signature object (PEP 362) gives more convenient way for gathering
> information about function spec.
>

I don't quite understand that comment - PEP 362 is purely an access
mechanism. The underlying storage is still in __annotations__ (at least as
far any annotations are concerned).

However, using separate storage is a natural consequence of also providing
an explicit decorator factory API, so I didn't bring it up.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121203/02d9b71e/attachment.html>


More information about the Python-ideas mailing list