Closed GoogleCodeExporter closed 9 years ago
Original comment by flier...@gmail.com
on 18 Sep 2012 at 12:50
I can't reproduce your issue, because Python will call __len__() when you use
bool() on an object which haven't provide __nonzero__ function.
object.__nonzero__(self)
Called to implement truth value testing and the built-in operation bool();
should return False or True, or their integer equivalents 0 or 1. When this
method is not defined, __len__() is called, if it is defined, and the object is
considered true if its result is nonzero. If a class defines neither __len__()
nor __nonzero__(), all its instances are considered true.
could you provide your sample code? Thanks
import PyV8
assert not bool([])
with PyV8.JSContext() as ctxt:
assert not bool(PyV8.JSArray([]))
Original comment by flier...@gmail.com
on 18 Sep 2012 at 1:21
Original issue reported on code.google.com by
nitrogen...@gmail.com
on 18 Sep 2012 at 5:39