Hi Mark,
I really like this PEP - it'll be useful to have more expressive ways of
annotating decorators. The current form looks pretty good to me. A few
comments:
* `typing.type_variable_operators` is quite verbose. How about just
`typing.operators`?
* For user-defined generic classes using a ParamSpec, I think it would be
useful to include an example of how such a class is constructed, since it
wasn't obvious to me where values with the parameters_expression type would
come from at runtime. Is
class X(Generic[P]):
def __init__(self, x: Callable[P, int]): ...
and variations the only way to create such a class? Or do P.args and
P.kwargs come into play in some way?
* "Inside the function, args has the type P.args, not Tuple[P.args, ...] as
would be with a normal annotation (and likewise with the **kwargs)"
(in the ParamSpec
semantics https://www.python.org/dev/peps/pep-0612/#id3 section). If I'm
reading this correctly, it's saying that P.args represents the full type of
args, Tuple and all, unlike a normal args annotation which describes just
the contained type. Why is that the case? It seems like it would be better
to not have this inconsistency unless it's necessary.
Also, some typos and such I noticed:
* "a*n* concrete instance" has an extraneous "n":
https://github.com/python/peps/blame/master/pep-0612.rst#L231
* I found the x_int_y_str, y_int_x_str
https://github.com/python/peps/blame/master/pep-0612.rst#L283 example
hard to read, since the slight differences between the two foo calls are
hard to spot. One way I can think of to improve this would be to make the
function names shorter (maybe just x_y and y_x?) so it takes less time to
spot the difference.
* Is this supposed to be Callable[[int, str], *int*]?
https://github.com/python/peps/blame/master/pep-0612.rst#L291
* The parameter to the remove function is defined as `x` and later referred
to as `f`: https://github.com/python/peps/blame/master/pep-0612.rst#L465
Best,
Rebecca
On Mon, Jul 13, 2020 at 8:47 PM Mark Mendoza
Hi All, I want to start off by thanking everyone that gave feedback on the first round of review of PEP 612. Your feedback illuminated a lot of things that I think have made this PEP a lot better. Over the past few weeks I have had the time to rewrite much of that document to integrate all of that feedback. Notably, this included integrating `typing.type_variable_operators.Concatenate` to support decorators that modify a finite number of positional parameters.
With that being said, I'd appreciate another round of feedback from all of you to determine whether this form of the PEP is ready to move on to the Steering Council.
Thanks again!
Mark Mendoza _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: rechen@google.com