Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.x
Description
A couple of examples in Qt for Python still use C++ syntaxing, idioms and coding styles. This user story relates to identifying and porting those examples to use Python styles and idoms (PEP 8).
Some examples are:
- Changing cameCase to snake_case for variable names and functions names. Keep in mind that when overriding Qt-methods that are required by a class this cannot be done.
- Simplify loops: we often see c++ styled for loops and could be replaced by Python loops
- Usage of context when possible, avoid using f = open(...), and use with open(...) as f: instead.
- Use pathlib when possible
- You could optionally adopt the _feature_ module, and rely on a code without setters/getters, and snake_case Qt API. Read more
Helpful Links:
- Python Styling Guide: https://peps.python.org/pep-0008/
- Get a list of non PEP8 issues of the code with Flake8 https://flake8.pycqa.org/en/latest/
- isort for ordering the import statements.
- Be mindful with using black, even when it's an amazing tool, some of the code we have can get formatted in a strange way, so if you are keen on using it, please do a manual check before submitting the change.