I’m talking about stuff like this: [
instead of the more verbose but maybe easier to grasp for python noobs: ]
for file in files:
file.unlink()
Maybe with a bit more context:
def _cleanup(self) -> None:
dirs, files = partition(lambda f: f.is_file(), self._tmp_dir.rglob("*"))
[file.unlink() for file in files]
[dir.rmdir() for dir in dirs]
self._tmp_dir.rmdir()
Typically I would expect for list comprehension to be used for data generation or filtering, so something like this definitely strikes odd when reading code and would just ask to unpack into classic loop