[pygtk] cleaner module reload?

Johan Dahlin johan at gnome.org
Fri Aug 13 05:20:48 WST 2004

> Yes, but this is cleaner:
>     if not hasattr(foo, "__gtype__"):
>         gobject.type_register(foo)

That won't work, since gobject.GObject has a __gtype__ property, so
hasattr will always return True. You need to check in your subclass and
make sure that python does not traverse its class and bases to fetch the

I still think the gobject.type_name is the most clean solution.

Johan Dahlin <johan at gnome.org>

More information about the pygtk mailing list