<div>My impression is that Phil intends for PyQt to generally resemble Qt as closely as practically feasible. This approach has advantages. It implies less complexity wrapping-wise, since the mapping is mostly direct, and once you know Qt itself you can easily work with PyQt (principle of least surprise). I find that PyQt being non-Pythonic mostly represents a threshold, which has little practical bearing once you have some experience with (Py)Qt. Also, it's a good thing when switching back and forth between C++ and Python (which some of us do).</div>
<div><br></div><div>Arve<br><br><div class="gmail_quote">On Wed, Jul 29, 2009 at 2:44 PM, Florian Friesdorf <span dir="ltr"><<a href="mailto:flo@chaoflow.net">flo@chaoflow.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello,<br>
<br>
Based on a longer python history and no Qt experience, I'm just starting<br>
with PyQt. My enthusiasm is a bit slowed down by the non-pythonic API:<br>
<br>
a = QAction()<br>
a.setEnabled(True)<br>
enabled = a.isEnabled()<br>
<br>
setting = QSettings()<br>
filename = 'some.file'<br>
qfilename = QVariant(QString(filename))<br>
settings.setValue("LastFile", qfilename)<br>
filename = settings.value("LastFile").toString()<br>
<br>
Preferably these would look something like:<br>
<br>
a = QAction()<br>
a.enabled = True<br>
enabled = a.enabled<br>
<br>
settings = QSettings()<br>
filename = 'some.file'<br>
settings["LastFile"] = filename<br>
filename = settings["LastFile"]<br>
<br>
<br>
One thing here is the implicit use of __getitem__() and __setitem__()<br>
instead of two different explicit functions. The other is a translation<br>
of QVariant to string and vice versa.<br>
<br>
- Are there any wrappers available that translate to a more<br>
pythonic API, i.e. not just direct bindings?<br>
- Could SIP be extended to create these, i.e. would it be<br>
sane to have SIP extended to create these?<br>
- Are there any plans to work towards a more pythonic API?<br>
- Am I the only one getting cognitive dissonance when programming with<br>
the less pythonic versions?<br>
<br>
<br>
best regards<br>
<font color="#888888">florian<br>
</font><br>_______________________________________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br></blockquote></div><br></div>