On 2021-12-14 01:50:45, Steven D'Aprano wrote: > On Sun, Dec 12, 2021 at 12:23:54PM -0800, Christopher Barker wrote: > > And I note that Annotated flattens nested Annotated types, so having both a > > docstring and other use of Annotated could be a bit tricky. > > class MyClass: > """Blah blah blah. > > Variable annotations of the form Annotated[T, 'string', *args] > always interpret the string in the second position as a > docstring. If you want to use Annotated but without a docstring, > put None in the second position. > """ > spam: Annotated[int, 'Yummy meat-like product'] > eggs: Annotated[float, 'Goes well with spam', Domain[0, 1]] > cheese: Sequence[str] # No docstring. > > > The metadata is *always* interpreted by the tool, this is no different.
What about having a docstring but no typing information? In this case that's impossible, no? _______________________________________________ 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/FTG5TDUGTYEOQCMQVD4T2WFLXS5EMNYK/ Code of Conduct: http://python.org/psf/codeofconduct/