It is subject to reference counting semantics in python.
#declare and and b as object with properties b and a, respectively, then do:
a.b = b
b.a = a
 
a and b are now impossible to delete. Next: 
a.b = None
del(a) #nope
del(b) #ok
 
 
Sent: Wednesday, February 05, 2020 at 7:23 PM
From: "Israel Brewster" <ijbrews...@alaska.edu>
To: pyside@qt-project.org
Subject: [PySide] Is del in python completely equivalent to delete in c for Qt objects?
In C++ Qt code, if I do something like the following:
 
QMainWindow *win=new QMainWindow()
<add other objects to win/do stuff with it>
delete win
 
The QMainWindow, as well as all of its children will be deleted, with the latter half of that statement being the important part. Of course, this child deletion is a Qt thing and not a C thing, as typically calling delete only deletes the thing it was called on. As such, I was wanting to confirm that, when using python/PySide2, calling del on a Qt object would trigger the same child deletion algorithm that delete does in C.
---
Israel Brewster
Software Engineer
Alaska Volcano Observatory 
Geophysical Institute - UAF 
2156 Koyukuk Drive 
Fairbanks AK 99775-7320
Work: 907-474-5172
cell:  907-328-9145
_______________________________________________ PySide mailing list PySide@qt-project.org https://lists.qt-project.org/listinfo/pyside
_______________________________________________
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside

Reply via email to