homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients rhettinger
Date 2011年07月27日.19:26:16
SpamBayes Score 1.3898632e-08
Marked as misclassified No
Message-id <1311794776.71.0.254853675833.issue12647@psf.upfronthosting.co.za>
In-reply-to
Content
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. This will simplify the explanation of what bool() does to: "bool(x) always returns True unless the object defines __bool__() to return False or defines __len__() to return a non-zero value".
The removal of the special case will slightly slow down tests for "if None", and it will slightly speed-up tests for "if x" where x is something other than True, False, or None.
History
Date User Action Args
2011年07月27日 19:26:16rhettingersetrecipients: + rhettinger
2011年07月27日 19:26:16rhettingersetmessageid: <1311794776.71.0.254853675833.issue12647@psf.upfronthosting.co.za>
2011年07月27日 19:26:16rhettingerlinkissue12647 messages
2011年07月27日 19:26:16rhettingercreate

AltStyle によって変換されたページ (->オリジナル) /