add some type annotations io/formats/format.py by simonjayhawkins · Pull Request #27418 · pandas-dev/pandas (original) (raw)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's fully required does making line 238 say
max_rows is not None and ...
get around that?
no. gives pandas\io\formats\format.py:249: error: Unsupported operand types for // ("None" and "int")
and there might be risk in implementing this differently anyway?
Generally we try to avoid cast
well I would have agreed with you when I started this, but after this PR, I think that adding type annotations should be just that and any refactoring or code cleanup should be deferred to a follow on PR.
I'm surprised MyPy can't narrow the type down here from None.
Agreed. hence the numerous iterations to try and avoid cast originally.