New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Little documentation of annotations #56404
Comments
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. |
We could beef this up a little bit, but it was intentional that we leave it completely open on how to use it. |
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. |
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 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: