micropython/micropython — pull request #238 by pfalcon (2014-01-30 03:10:17+00:00)
Title: Implement __bool__ and __len__ via unary_op virtual method for all types.

Per #229

__bool__() and __len__() are just the same as __neg__() or __invert__(),
and require efficient dispatching implementation (not requiring search/lookup).
type->unary_op() is just the right choice for this short of adding
standalone virtual method(s) to already big mp_obj_type_t structure.