[Python-ideas] Conventions for function annotations

Robert McGibbon rmcgibbo at gmail.com
Sun Dec 2 11:12:06 CET 2012


Nick,

Thanks! You make a very convincing argument.

Especially if this represents the collective recommendation of the python core development team on the proper conventions surrounding the use of function annotations, I would encourage you guys to perhaps make it more widely known (blogs, etc). As python 3.x adoption continues to move forward, this type of thing could become an issue if shmucks like me start using the annotation feature more widely.

-Robert

On Dec 1, 2012, at 10:58 PM, Nick Coghlan wrote:

> Mixing annotations intended for different consumers is a fundamentally bad idea, as it encourages unreadable code and complex dances to avoid stepping on each other's toes. It's better to design a *separate* API that supports composition by passing the per-parameter details directly to a decorator factory (which then adds appropriate named attributes to the function), with annotations used just as syntactic sugar for simple cases where no composition is involved.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121202/0740707a/attachment.html>


More information about the Python-ideas mailing list