This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Little documentation of annotations
Type: Stage:
Components: Documentation Versions: Python 3.2
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: JJeffries, docs@python, eric.araujo, rhettinger
Priority: normal Keywords:

Created on 2011-05-27 12:22 by JJeffries, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg137047 - (view) Author: JJeffries (JJeffries) Date: 2011-05-27 12:22
There are very few pages relating to annotations in the documentation. Making it very unclear how they work and what they could be used for other than the original PEP.
msg137050 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-05-27 13:48
We could beef this up a little bit, but it was intentional that we leave it completely open on how to use it.
msg141960 - (view) Author: JJeffries (JJeffries) Date: 2011-08-12 14:47
While I understand the reluctance to unintentionally push people along a particular path, but I think there is being open on how to use it and not mentioning it. I think that currently the current documentation is the latter and some simple examples showing the syntax would go a long way.

Most of my understanding of annotations has come from the PEP for it and mailing lists.
msg143021 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-08-26 16:49
> 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.
History
Date User Action Args
2022-04-11 14:57:17adminsetgithub: 56404
2011-08-26 16:49:10rhettingersetstatus: open -> closed
resolution: rejected
messages: + msg143021
2011-08-26 16:14:55eric.araujosetnosy: + eric.araujo
2011-08-12 14:47:44JJeffriessetmessages: + msg141960
2011-05-27 13:48:36rhettingersetassignee: docs@python -> rhettinger

messages: + msg137050
nosy: + rhettinger
2011-05-27 12:22:12JJeffriescreate