On Sat, Dec 11, 2021 at 10:49 AM Ricky Teachey <ri...@teachey.org> wrote:
> The __annotations__ already exists. Is that a point in favor? > Yes and no. Right now, any object can be stored in annotations — having a docstring tacked on would break who knows how much code. However, there is the new inspect.get_annotations function, which could be adapted to process doc strings. https://docs.python.org/3/howto/annotations.html If the syntax could become sugar for creating an Annotated object in > __annotations__, this would be a pretty convenient location to find them. > > On the other hand, not every type hinted variable will have a docstring. > And not every attribute with a docstring would have an annotation. It seems like storing them in a so called __attr_doc__ might be the most > straightforward thing to do. > Yes, as doc strings really are a different thing. Though one might to also document other things like function parameters— which would be an argument for extending what __annotations__ is used for. If that were done, does it matter that the contents of __attr_doc__ and > __annotations__ are not coupled? > I don’t think so — they are quite different concepts. -CHB -- Christopher Barker, PhD (Chris) Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/OTIC243UANQAVFSI3JAHQZATFRDKT7KJ/ Code of Conduct: http://python.org/psf/codeofconduct/