Fwiw I read Eric's entire proposal (I like it) but totally missed the
presence of single, double, triple underscores.
Which caused me to be very confused reading Matt De Valle's reply, until I
went back and noticed them, and the lightbulb went on.
Based on that experience, and also Matt's comment about how people might
automatically try to add a second signature directive using the same
variable name, I would suggest that maybe it would be preferred, when
giving examples in documentation etc, to not use underscores like this as
the placeholders.... It is easy to miss that the variable names are
required to be different.
Different comment: in the other thread I liked the idea of mimicking the
syntactical way of writing a function signature (although this might cause
other problems):
@dataclass
class C:
# positional only arguments required at top
a: Any
Pos : '/' # normal only after this line, can't go back
b: Any
Kwd: '*' # kwd only after this line, can't go back
c: Any
But as Eric pointed out, there could be a lot of value in being able to go
back and forth. I know think his idea is better.
BIKE SHED:
If switching back and forth does win out, I think we should NOT try to use
the characters '/' and '*' to specify the signature directives because they
would lead the reader to believe they work the same as in a function
signature.
Aside from the issue if going back and forth, in Eric's proposal the
positional directive comes *before* the positional arguments, rather than
after like in a function signature. Since this is so different, please
don't try to use '/'.
_______________________________________________
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/FYDLY5CY7XTJ6TME3RCDHL53VX4AQ3WB/
Code of Conduct: http://python.org/psf/codeofconduct/