Argument-Clinic / cpython

The Python programming language
https://www.python.org/
Other
1 stars 0 forks source link

gh-104683: Make Argument Clinic parser template strings class level members #10

Closed erlend-aasland closed 1 year ago

erlend-aasland commented 1 year ago

What do you think of this? IMO, all these static strings pollute output_templates. I'm trying to improve the readability of that method.

erlend-aasland commented 1 year ago

Makes sense! You could annotate them with Final[str] to indicate to mypy that they're meant to be class-level "constants" that are never changed when accessed on the class or the instance -- they are set once, and then should be treated by the type checker as read-only after that

Neat!

erlend-aasland commented 1 year ago

Opened python/cpython#107556