Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0da885a

Browse files
committed
Merge pull request #1493 from minrk/retFalse
Fix coercion of values to False in _on_timer() introduced in PEP8 clean-up. Fixes #1492.
2 parents de724f1 + 73371b0 commit 0da885a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,12 +1118,14 @@ def _timer_set_single_shot(self):
11181118
def _on_timer(self):
11191119
'''
11201120
Runs all function that have been registered as callbacks. Functions
1121-
can return False if they should not be called any more. If there
1121+
can return False (or 0) if they should not be called any more. If there
11221122
are no callbacks, the timer is automatically stopped.
11231123
'''
11241124
for func, args, kwargs in self.callbacks:
11251125
ret = func(*args, **kwargs)
1126-
if not ret:
1126+
# docstring above explains why we use `if ret == False` here,
1127+
# instead of `if not ret`.
1128+
if ret == False:
11271129
self.callbacks.remove((func, args, kwargs))
11281130

11291131
if len(self.callbacks) == 0:

0 commit comments

Comments
 (0)