On Thu, Nov 13, 2014 at 8:24 AM, Alan G Isaac <alan.is...@gmail.com> wrote:
> On 11/13/2014 1:19 AM, Antony Lee wrote: > > "t.__bool__()" also returns True > > > But t.__nonzero__() is being called in the `if` test. > The question is: is the difference between `__nonzero__` > and `__bool__` intentional. > > By the way, there has been a change in behavior. > For example, in 1.7.1 if you call `t.__bool__()` > it raised an attribute error -- unless one first > called `t.__nonzero__()` and then called `t.__bool__()`, > which was of course very weird and needed to be fixed. > Maybe (?) not like this. > The change probably came in with the Python2/3 common code base. Python3 replaces `__nonzero__` with `__bool__`. IIRC, the two are now the same method. I don't have the code available to check... <snip> Chuck
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion