On 9/12/21 12:50 am, tmkehrenb...@gmail.com wrote:
The main criticism, I think, was that it is weird to have the docstring *below* the attribute.
I don't think that's a problem. The docstring of a class or function is also below the name of the class or function. I think it's actually more consistent that way. It seems excessive to invent a whole new type of string just for this purpose. The neat thing about the docstring convention is that it doesn't require any special syntax. It would also raise some other questions, such as what happens if you use a d-string in some other context? Does it just behave as an ordinary string? Is it disallowed?
# in my_module.py: d"Number of days in a week." DAYS_PER_WEEK: Final = 7
Does this mean you could also use it on module-level functions? d"This function is really important." def f(): ... That would give you two different ways to document a function, and it seems you could use both of them at the same time, which could be confusing. If you're looking for documentation of a function, there are two places you would have to look -- in the function itself, and in the module where it's defined. Similarly for classes. -- Greg _______________________________________________ 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/H5LQ5EHICVUOW75FYW6DMZAEYZBA2GAE/ Code of Conduct: http://python.org/psf/codeofconduct/