5 ms·
He's referring to the special methods available to classes that allow implementation of the truth value of an object. In version 2.x of Python, this method is _
by mattbot5000 13y ago
He's referring to the special methods available to classes that allow implementation of the truth value of an object. In version 2.x of Python, this method is __nonzero__[1] and in version 3.x it's called __bool__[2]
[1] http://docs.python.org/2/reference/datamodel.html#object.__nonzero__ http://docs.python.org/2/reference/datamodel.html#object.__n...
[2] http://docs.python.org/3/reference/datamodel.html#object.__bool__ http://docs.python.org/3/reference/datamodel.html#object.__b...