mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
[py3] Replaced __nonzero__ by __bool__
Of course, __nonzero__ alias has been kept for Python 2 compatibility.
This commit is contained in:
@@ -152,9 +152,10 @@ class BoundMethodWeakref(object):
|
||||
|
||||
__repr__ = __str__
|
||||
|
||||
def __nonzero__( self ):
|
||||
def __bool__( self ):
|
||||
"""Whether we are still a valid reference"""
|
||||
return self() is not None
|
||||
__nonzero__ = __bool__ # Python 2
|
||||
|
||||
def __eq__(self, other):
|
||||
"""Compare with another reference"""
|
||||
|
||||
Reference in New Issue
Block a user