[Python-bugs-list] [ python-Bugs-820397 ] __nonzero__() returns 1/0
SourceForge.net
noreply at sourceforge.net
Wed Oct 8 22:34:36 EDT 2003
Bugs item #820397, was opened at 2003-10-09 11:34
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=820397&group_id=5470
Category: None
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: George Yoshida (quiver)
Assigned to: Nobody/Anonymous (nobody)
Summary: __nonzero__() returns 1/0
Initial Comment:
This is similar to Patch [820195].
http://www.python.org/sf/820195
number.__nonzero__() returns 1/0,
while number != 0 returns True/False.
>>> n = 1
>>> n.__nonzero__()
1
>>> n != 0
True
>>> n = 0
>>> n.__nonzero__()
0
>>> n != 0
False
>>> c = 1+1j
>>> c.__nonzero__()
1
>>> c != 0
True
>>> c = 0j
>>> c.__nonzero__()
0
>>> c != 0
False
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=820397&group_id=5470
More information about the Python-bugs-list
mailing list