Re: testing for GType == 0



Hi Daniel, here's my example:

$ python
Python 2.7.11+ (default, Apr 17 2016, 14:00:29)
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import gi
gi.require_version('Vips', '8.0')
from gi.repository import Vips
image = Vips.Image.new()
gt = image.get_typeof("banana")
gt
<GType invalid (0)>

vips_image_get_typeof() is the C function that's being called. It
looks up the GType of a bit of image metadata and returns 0 (invalid
type) if there's nothing of that name.

http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/libvips-header.html#vips-image-get-typeof

What would be the best way to test the return value of image.get_type()
for invalid?

John




On 18 June 2016 at 13:20, Daniel Espinosa <esodan gmail com> wrote:
May additional data could help to suggest better methods.

El jun. 18, 2016 7:07 AM, <jcupitt gmail com> escribió:
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?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]