File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -323,11 +323,10 @@ def __hash__(self):
323
323
raise TypeError ("Signals are unhashable" )
324
324
325
325
326
- def __nonzero__ (self ):
327
- if self ._val :
328
- return 1
329
- else :
330
- return 0
326
+ def __bool__ (self ):
327
+ return bool (self ._val )
328
+
329
+ __nonzero__ = __bool__
331
330
332
331
# length
333
332
def __len__ (self ):
Original file line number Diff line number Diff line change @@ -114,11 +114,10 @@ def __iter__(self):
114
114
return iter ([self [i ] for i in range (self ._nrbits - 1 , - 1 , - 1 )])
115
115
116
116
# logical testing
117
- def __nonzero__ (self ):
118
- if self ._val :
119
- return 1
120
- else :
121
- return 0
117
+ def __bool__ (self ):
118
+ return bool (self ._val )
119
+
120
+ __nonzero__ = __bool__
122
121
123
122
# length
124
123
def __len__ (self ):
You can’t perform that action at this time.
0 commit comments