On 3/16/21 1:19 PM, Brendan Barnwell wrote:
On 2021-03-16 06:20, Eric V. Smith wrote:
I'd like to avoid field() as much as possible. I think it's just too
easy to miss what it's doing, since it has many arguments. And I'd like
to make it easy to have a style that encourages all non-keyword-only
fields to come first.
From my perspective it's quite the contrary. `field` is an actual
function call and its arguments may affect its behavior in the way that
arguments generally affect function calls. This thing with a dummy
attribute holding a magic value whose sequential position in the class
body influences *different* attributes based on their *relative*
sequential position. . . I find that much more confusing and strange.
I think Simão's version where you give a class-level default for
keyword-only-ness and then override it with field() arguments where
necessary is much cleaner.
I agree with Eric. The class body is basically a vertical representation of
the horizontal `__init__` header. As such, `KW_ONLY` and (maybe in the future)
POS_ONLY match very nicely.
--
~Ethan~
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/S6EMN2BDFZMESALHLAPLZDUGN2BJL7LF/
Code of Conduct: http://python.org/psf/codeofconduct/