When coding in PyQt (or PySide), should I use Python functions or the equivalent Qt functions?
pyqt, pyside, python
Solution
As I understand, many of those Qt functions were put in for cross-platform compatibility, and others to integrate with Qt. However, Python already includes cross-platform functions, so I would favor Python ones when possible since they're
- More familiar to Python programmers
- Doesn't make you so dependent on Qt
- Fits in with Python's idioms
However, you may have to use Qt's functions since they integrate with Qt and/or they provide functionality that Python doesn't.
This has been discussed for other languages, e.g. C++: Qt: Qt classes vs. standard C++
Really, it depends on whether you want to write a Qt application or a Python application.
Problem
When writing code using PyQt or PySide, sometimes the equivalent function is available in both Qt and Python (e.g., `QDir.exists` in Qt vs `os.path.exists` in Python). In these cases, is there an established practice for which language to use? I am wondering if issues of speed, refactoring, etc. might be relevant to the decision. Thanks.