[docs] [issue12195] Little documentation of annotations

Raymond Hettinger report at bugs.python.org
Fri Aug 26 18:49:11 CEST 2011

Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

> some simple examples showing the syntax would go a long way.

Sorry, there as just too many ways to go and we are intentionally not stating which way is preferred.  I've seen many variants  a:[Integral] for a list of integers, a:(int,str) for a 2-tuple of an int and a string, a:(str,file,None) for something that is a string or a file or None, a:'light_years' to indicate units of measure, a:range_check(10.5, 20.1) for range validation, and some variants for converters, adapters, factory functions, documentation aids, etc.

If you want to advance the state of the art, perhaps write a blog post on what you consider to be a best practice.  If a consensus emerges, we 
will follow.

resolution:  -> rejected
status: open -> closed

Python tracker <report at bugs.python.org>

More information about the docs mailing list