Depends. If you are storing a GObject use the 'is' operator over returned one, if you just return null if not found check it first.
if (!(obj is BaseObject)) or if have just a type stored and is used to create GObject based on it if (gtype.is_a(typeof(Object)) May additional data could help to suggest better methods. El jun. 18, 2016 7:07 AM, <jcup...@gmail.com> escribió: > Hi all, I have a stupid question. > > I'm calling a function that does a type lookup, and it can return 0 > for type not found. What's the best way to test for this in my > overrides? > > At the moment I'm doing: > > gtype = Some.function(thing) > if gtype.name == 'invalid': > # we had a zero return > > But there must be a better way. > > John > _______________________________________________ > python-hackers-list mailing list > python-hackers-list@gnome.org > https://mail.gnome.org/mailman/listinfo/python-hackers-list >
_______________________________________________ python-hackers-list mailing list python-hackers-list@gnome.org https://mail.gnome.org/mailman/listinfo/python-hackers-list