Message177151
Example:
>>> import sched
>>> s=sched.scheduler()
>>> s.enter(10, 1, print)
Event(time=7452.676787873, priority=1, action=<built-in function print>, argument=[], kwargs={})
>>> next(s.queue).argument.append("spam")
>>> s.enter(5, 1, print)
Event(time=7473.326011725, priority=1, action=<built-in function print>, argument=['spam'], kwargs={})
>>> s.run()
spam
spam
Now every s.enter() call (even for other schedulers) without explicit "argument" use ['spam'] as "argument".
Usually functions should not have modifiable arguments (unless it is intentional). We should use non-modifiable value or a sentinel for default. For example an empty tuple as default for "argument" and None as default for "kwargs". |
|
Date |
User |
Action |
Args |
2012-12-08 10:14:21 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, giampaolo.rodola |
2012-12-08 10:14:21 | serhiy.storchaka | set | messageid: <1354961661.69.0.670095014649.issue16641@psf.upfronthosting.co.za> |
2012-12-08 10:14:21 | serhiy.storchaka | link | issue16641 messages |
2012-12-08 10:14:21 | serhiy.storchaka | create | |
|