On 8/2/06, Federico Mena Quintero <[EMAIL PROTECTED]> wrote:

[...]

The usual idiom  is to have a way to explicitly dispose an object which
holds a reference to a non-GC resource.  In C# you do

  obj = new SomeObject ();
  treeview.set_model (obj);

  newobj = new SomeObject ();
  treeview.set_model (newobj);

  obj.Dispose ();

or use syntactic sugar:

  using (Gdk.Pixbuf pixbuf = new Gdk.Pixbuf ("foo.jpg")) {
      do_something_with_pixbuf (pixbuf);
  } /* exiting the "using" block disposes the pixbuf */

This is pretty useful for managed objects which maintain non-managed
data (file descriptors, memory buffers, database connections, etc.).

Does Python let you do something like this?

It should be possible to export g_object_unref() through the pygobject API.
That would of course be not pythonic at all and not trigger collection
if any other (uncollected) python objects are still holding
references.
(/me waits for pygtk devs to point out more flaws)

- Rob
_______________________________________________
Sugar mailing list
[email protected]
http://mailman.laptop.org/mailman/listinfo/sugar

Reply via email to