[Python-ideas] Automatic context managers

anatoly techtonik techtonik at gmail.com
Thu Apr 25 06:47:00 CEST 2013


On Thu, Apr 25, 2013 at 7:23 AM, Cameron Simpson <cs at zip.com.au> wrote:

> On 25Apr2013 06:49, anatoly techtonik <techtonik at gmail.com> wrote:
> | On Wed, Apr 24, 2013 at 2:50 PM, Joao S. O. Bueno <jsbueno at python.org.br
> >wrote:
> | > On 24 April 2013 05:59, anatoly techtonik <techtonik at gmail.com> wrote:
> | > > PySide Qt binding have an interesting property - when you create
> widgets,
> | > > you need to assign them to variables. When such variable is lost,
> object
> | > is
> | > > immediately destroyed.
> | >
> | > I truly hope it is not quite as you describe - otherwisew pySie would
> | > be completly unusable.
> | > What if one adds created objects to a list, instead of assigning them
> | > to a variable?
> |
> | As long as the list references the widget, the widget won't be destroyed.
> | "assign to variable" is not a correct term - I guess "reference keeping"
> is
> | better.
>
> Then aren't you just talking about the __del__ method?
>

No. The __del__ method is only called during garbage collection phase which
may be delayed. In PySide the QObject is deleted immediately.
-- 
anatoly t.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130425/464e37be/attachment.html>


More information about the Python-ideas mailing list