[Python-ideas] Automatic context managers

Cameron Simpson cs at zip.com.au
Thu Apr 25 06:23:35 CEST 2013


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?
-- 
Cameron Simpson <cs at zip.com.au>

Ninety percent of everything is crud.   - Theodore Sturgeon



More information about the Python-ideas mailing list