On Wed, Dec 08, 2021 at 09:45:35AM -0800, Paul Bryan wrote:

> I propose there is already a viable option in typing.Annotated.
> Example: 
> 
> @dataclass
> class InventoryItem:
>     """Class for keeping track of an item in inventory."""
>     
>     name: Annotated[str, "Short name of the item."]
>     unit_price: Annotated[float, "Price per unit in dollar."]
>     ...

Oh nice! Guido's time machine strikes again.

So dataclasses could recognise Annotated and populate `__attrdoc__`.

Should all classes do the same? How about top level module variables?



-- 
Steve
_______________________________________________
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/23GMGHDEW6OMDASIXAPC6WQDJYQFJR5M/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to