You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After implementing per-argument type comments in the mypy (and the typed_ast library it uses), there are a few points in the PEP that might be worthy of clarification/further specification.
It doesn't make sense for an argument to have both a type annotation and a type comment, but I don't think the PEP mentions that that is disallowed. It probably should.
My reading of the PEP suggests this is already the case, but it could be worth being explicit that you don't have to specify a return type to use per-argument type comments.
Would it be acceptable to only allow per-argument type comments after an argument's associated comma, if any?
E.g. this is acceptable:
deff(x, # type: inty# type: str
):
pass
but this would not be:
deff( x# type: int
, y# type: str
):
pass
The first form is generally considered more Pythonic, and supporting the second form would add significant implementation complexity.
The text was updated successfully, but these errors were encountered:
It doesn't make sense for an argument to have both a type annotation and a type comment, but I don't think the PEP mentions that that is disallowed. It probably should.
Agreed. The PEP already says this, but pretty weakly: "To specify the return type use the ellipsis syntax."
My reading of the PEP suggests this is already the case, but it could be worth being explicit that you don't have to specify a return type to use per-argument type comments.
That same sentence was meant to also cover this. :-) Agreed it's too subtle.
Would it be acceptable to only allow per-argument type comments after an argument's associated comma, if any?
Also agreed. This was implicit in the example. :-)
After implementing per-argument type comments in the mypy (and the typed_ast library it uses), there are a few points in the PEP that might be worthy of clarification/further specification.
It doesn't make sense for an argument to have both a type annotation and a type comment, but I don't think the PEP mentions that that is disallowed. It probably should.
My reading of the PEP suggests this is already the case, but it could be worth being explicit that you don't have to specify a return type to use per-argument type comments.
Would it be acceptable to only allow per-argument type comments after an argument's associated comma, if any?
E.g. this is acceptable:
but this would not be:
The first form is generally considered more Pythonic, and supporting the second form would add significant implementation complexity.
The text was updated successfully, but these errors were encountered: