This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients giampaolo.rodola, serhiy.storchaka
Date 2012-12-08.10:14:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1354961661.69.0.670095014649.issue16641@psf.upfronthosting.co.za>
In-reply-to
Content
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".
History
Date User Action Args
2012-12-08 10:14:21serhiy.storchakasetrecipients: + serhiy.storchaka, giampaolo.rodola
2012-12-08 10:14:21serhiy.storchakasetmessageid: <1354961661.69.0.670095014649.issue16641@psf.upfronthosting.co.za>
2012-12-08 10:14:21serhiy.storchakalinkissue16641 messages
2012-12-08 10:14:21serhiy.storchakacreate