Hacker News new | past | comments | ask | show | jobs | submit login

Hi author!

When I used Qt4 years ago, I ran into a lot of issues regarding segfaults and generally issues with the underlying C++ objects. Admittedly this was largely my fault, but I did find that I had to worry about the underlying implementation a lot and not think idomatically in Python as much.

Have things improved?




I haven't used Qt4, but I haven't had issue with segfaults and pure C++/QML integration.

When it comes to the .NET integration, you don't have to worry about the .NET GC or the JavaScript GC. There are extensive unit tests to ensure that the two garbage collectors work together.

I would actually say it's impossible to make QmlNet segfault.


The specifics get a bit annoying and pedantic. I'm guessing you were dealing with Qt4, PyQt, and Python2? PyQt was a separate thing written by Riverbank Computing (sip was the binding interface). The bummers were it wasn't open source and had separate licensing. In 2009, the Qt people (Nokia at the time) released PySide. Shiboken is the new binding interface. It was mostly compatible with PyQt, open source, better license, and was more idiomatic with Python (Python unicode strings instead of QString, more decorators on functions instead of having to call specific functions in a specific way).

Qt5 was released in 2012. A lot of the user-facing focus was on QML. QtWidgets (the only part I'm familiar with) are now considered "feature complete." That means they're not deprecated, but not getting any new development. PySide2 is PySide with Qt5 support. That took awhile (especially to get Python2 support) and PySide2 was later branded "Qt for Python" even though the imports are still "pyside2." During this time many people transitioned to Python3.

Sorry to throw out so many things. A lot has changed, not all of it might be relevant to you, but I figured I'd mention them so you have a reference point if you want to jump back in or look more into what has changed.

Now to actually address your question. Pyside2 is a pretty big step towards making Qt more idiomatic to Python. I can't speak definitively on the rest of the transitions, but I don't think much has changed. Maybe QML and Python3 are more idiomatic?

After using them for a decade, I feel like idiomatic Python just doesn't have the constructs needed for an event driven gui so it has to lean on C++ and other things Qt built. Or Qt integration was done so long ago, it wasn't built around newer Python things like asyncio. I also can't speak too much to Python3 since my day job still uses Python2/PySide2/Qt5, but I've been looking at the new Python3 packages for years. Unfortunately, I feel like a lot of the async stuff added to Python isn't as terse and elegant as seeing something written in C ported to Python. Maybe I need to recalibrate what I think of as "Pythonic" when I get to use Python3 day-to-day?

As an anecdote of Python lacking necessary constructs, I've stumbled on co-workers using parts of QtCore outside of any GUI because it was the best library they had handy. I wish I could remember some of the use-cases, though.


PyQt has always been open-source - it’s dual-licensed under GPL 2 and commercial.

What you meant to write probably was “PyQt is not free to use in closed-source applications”.


My company uses Qt5 via Python fairly extensively. While it's great almost all the time, we've definitely encountered a few weird issues with segfaults, especially on Windows. Some our fault, some due to weird Qt/graphics driver interactions.


Recent PyQt segfaults a bit less than it used to do in Qt4-times. I believe Riverbank made some efforts to avoid the most common problems with object lifecycle. This said, underneath C++ and CPython have very different ideas about lifecycle, and Qt is very complex, so the occasional issue has to be expected.

I cannot speak for pyside/“qt for python”, but that project has always lagged behind PyQt, so it’s unlikely to be much better.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: