Commit 7c754a6
committed
Improve
These methods have a generic `type: ignore` with no clarification why.
The issue is we need the ignore here because otherwise `mypy` will give
this error:
> Overloaded operator methods can't have wider argument types in
> overrides
The problem seems to be when the other type implements an
**incompatible** __rmul__ method, which is not the case here, so we
should be safe.
Please see this example:
https://github.com/python/mypy/blob/c26f1297d4f19d2d1124a30efc97caebb8c28616/test-data/unit/check-overloading.test#L4738C1-L4769C55
And a discussion in a mypy issue here:
python/mypy#4985 (comment)
For more information.
This commit uses a more specific `type: ignore[override]` and add a
comment clarifying this.
Signed-off-by: Leandro Lucarella <[email protected]>type: ignore for __mul__
1 parent f78393f commit 7c754a6
1 file changed
+13
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
609 | | - | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
610 | 618 | | |
611 | 619 | | |
612 | 620 | | |
| |||
758 | 766 | | |
759 | 767 | | |
760 | 768 | | |
761 | | - | |
| 769 | + | |
| 770 | + | |
762 | 771 | | |
763 | 772 | | |
764 | 773 | | |
| |||
885 | 894 | | |
886 | 895 | | |
887 | 896 | | |
888 | | - | |
| 897 | + | |
| 898 | + | |
889 | 899 | | |
890 | 900 | | |
891 | 901 | | |
| |||
0 commit comments