diff --git a/OpenGL/latebind.py b/OpenGL/latebind.py index dc28dc28..3b01133f 100644 --- a/OpenGL/latebind.py +++ b/OpenGL/latebind.py @@ -29,7 +29,9 @@ def finalise( self ): return final callable """ - + def __nonzero__(self): + """Resolve our final call and check for empty/nonzero on it""" + return bool(self.getFinalCall()) def __call__( self, *args, **named ): """Call self._finalCall, calling finalise() first if not already called diff --git a/accelerate/src/latebind.pyx b/accelerate/src/latebind.pyx index f2748240..f009a76e 100644 --- a/accelerate/src/latebind.pyx +++ b/accelerate/src/latebind.pyx @@ -14,6 +14,11 @@ cdef class LateBind: def finalise( self ): """Finalise our target to our final callable object""" + def __nonzero__(self): + """Resolve our final call and check for empty/nonzero on it""" + return bool(self.getFinalCall()) + __bool__ = __nonzero__ + def getFinalCall( self ): """Retrieve and/or bind and retrieve final call""" if not self._finalCall: