[issue12647] Add __bool__ to None

2011-07-28 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue12647] Add __bool__ to None

2011-07-28 Thread Roundup Robot
Roundup Robot added the comment: New changeset ccce01988603 by Raymond Hettinger in branch 'default': Issue 12647: Add __bool__() method to the None object. http://hg.python.org/cpython/rev/ccce01988603 -- nosy: +python-dev ___ Python tracker

[issue12647] Add __bool__ to None

2011-07-28 Thread Daniel Urban
Changes by Daniel Urban : -- nosy: +durban ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.o

[issue12647] Add __bool__ to None

2011-07-27 Thread Antoine Pitrou
Antoine Pitrou added the comment: > > I'm not sure why the special case shouldn't be retained. > > We can keep the fast path in PyObject_IsTrue but add a __bool__ method to > NoneType. That's what I meant. -- ___ Python tracker

[issue12647] Add __bool__ to None

2011-07-27 Thread STINNER Victor
STINNER Victor added the comment: > I'm not sure why the special case shouldn't be retained. We can keep the fast path in PyObject_IsTrue but add a __bool__ method to NoneType. -- nosy: +haypo ___ Python tracker

[issue12647] Add __bool__ to None

2011-07-27 Thread Antoine Pitrou
Antoine Pitrou added the comment: I'm not sure why the special case shouldn't be retained. It's obviously there for speed reasons. -- nosy: +pitrou ___ Python tracker ___ _

[issue12647] Add __bool__ to None

2011-07-27 Thread Eric Snow
Eric Snow added the comment: And this doesn't impact "if x is None", so +1. -- nosy: +ericsnow ___ Python tracker ___ ___ Python-bugs

[issue12647] Add __bool__ to None

2011-07-27 Thread Brett Cannon
Brett Cannon added the comment: It all sounds good to me. Less magic behind the scenes is good. -- nosy: +brett.cannon ___ Python tracker ___ ___

[issue12647] Add __bool__ to None

2011-07-27 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- keywords: +patch Added file: http://bugs.python.org/file22781/none_bool.diff ___ Python tracker ___

[issue12647] Add __bool__ to None

2011-07-27 Thread Raymond Hettinger
New submission from Raymond Hettinger : Currently bool(None) returns False only because it has a special case in PyObject_IsTrue(). All other types can become False only if they implement __bool__() or __len__(). I propose removing the special case branch and instead adding __bool__ to None.