Default argument for QApplication?

Phil Thompson phil at
Fri Aug 27 12:25:49 BST 2021

On 27/08/2021 12:20, Florian Bruhin wrote:
> Hi,
> PyQt requires passing sys.argv (or [] for quick tests) to QApplication,
> probably because Qt in C++ requires passing argc/argv.
> I recently noticed that PySide (both 2 and 6) doesn't require that, and
> defaults to sys.argv when no argument is given. While a [] is only two
> characters, sometimes even for quick test scripts it'd be good to pass
> custom arguments to Qt, and an "import sys" and passing "sys.argv" is a
> bit more typing :)
> Maybe PyQt should default to sys.argv as well? Or do you prefer
> "explicit is better than implicit" here?

It's something I've considered many times (because it's a trivial 
change), but if you start improving on the Qt API (rather than just 
trying to predictably follow it) then you'd never stop.


More information about the PyQt mailing list