Thomas Perl wrote:
> As for the original topic (shortening the QApplication propogue) - it
> does not really get that much more compact (in terms of lines saved
> vs. complexity added), and it would make it more difficult (i.e. not
> straightforward) to "translate" a PySide app to the C++ API of Qt. You
> could still write a "convenience" module yourself and share it with
> the list / put it in the PySide Wiki and use it in all your projects -
> in my opinion, it does not belong in the standard PySide distribution
> (but maybe there's a place for a "PySide contrib" section?).
Like I said to linjunhalida, it is more about unifying QCoreApplication.exit()
and sys.exit() in order to avoid bugs and simplify the programming model than
it is about shortening the code.
Actually, you have to think in terms of incentives to really understand what
I'm proposing. As I explained in reply to linjunhalida, the C++ startup idiom
is a great way to provide incentives to pass the real (argc,argv) to Qt, and to
return the exec() value to the OS. Unfortunately when you translate this idiom
to Python verbatim, the incentives shift: because sys is not available by
default and because it's easy to build an empty list from scratch, it is very
tempting to pass [] instead of sys.argv; and because the typical Python program
doesn't end with sys.exit, it is very tempting to ignore the value of exec_().
To fix that, providing a headache-free way of doing the right thing will always
be the best incentive.
As for trying to deviate as little as possible from the C++ API, that could be
a valid goal for the project, but I think PySide developers are not aiming for
that: they try to improve the Python API wherever it can be improved, as can be
seen with the new signals and slots and the Python-style attributes PSEP. Both
make porting to C++ harder, and the lack of distinction between pointers and
references was already making porting non-trivial. Of course simplifying
QApplication would not be as big of an improvement as these changes, but then
again it would not make porting to C++ much harder (if you have trouble looking
up the C++ Qt startup idiom, you will have a very hard time porting a whole
application to C++).
Cheers,
Farsmo
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside