-
-
Notifications
You must be signed in to change notification settings - Fork 1
Python naming conventions
benoit74 edited this page Jun 20, 2024
·
2 revisions
For all openZIM and Kiwix projects in Python, we have some preferences in terms of how we name things. While not mandatory from a functional perspective, these preferences are important in terms of software homogeneity and ease of review for maintainers.
Exception variables should be named exc
.
Don't
except Exception as e:
Do
except Exception as exc:
We regularly manipulate a file path, e.g. the path (usually from pathlib.Path
) to a file. This should be named fpath
.
Don't
file_path = pathlib.Path(folder) / file
Do
fpath = pathlib.Path(folder) / file