Quantum
Quantum copied to clipboard
Optimization: Remove redundant `list` call in `check_file` in `Build/check_indents.py`
In the check_file function of Build/check_indents.py, it is performing a redundant list call, on f.readlines() which itself returns a list, in line 28:
def check_file(filename : str) -> bool:
...
with open(filename, 'r') as f:
contents = list(f.readlines())
...
This can have impact on performance, if the file is really large. This does not have any benefit over the plain f.readlines() either.
I propose the following change:
- contents = list(f.readlines())
+ contents = f.readlines()
Would be happy to add a PR, if the above proposal sounds reasonable.
Thanks for raising this, and for your patience! Would be happy if you'd still be interested in opening a PR!
Sure, I will add one today.