classification
Title: sched.py kwargs addition and default time functions
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: clach04, ezio.melotti, giampaolo.rodola, mark.dickinson
Priority: normal Keywords: patch

Created on 2011-10-22 19:05 by clach04, last changed 2011-11-22 12:40 by giampaolo.rodola. This issue is now closed.

Files
File name Uploaded Description Edit
kwargs_def_timer.patch clach04, 2011-10-22 19:05
issue13245.patch giampaolo.rodola, 2011-11-21 23:39 review
Messages (6)
msg146180 - (view) Author: Chris Clark (clach04) * Date: 2011-10-22 19:05
I ended up implementing my own sched.py equivalent as I needed kwargs support. This is my attempt to improve the stdlib, so I can throw my module way ;-)

Added kwargs support, and made "argument" optional. "argument" is still named argument, I would like to rename this args but I'm unclear on the backwards compat rules for stdlib, in theory it should be fine unless someone has code that treats argument as a keyword arg).

The scheduler init no long requires timer functions to be provided, it defaults to time.time, time.sleep as a helper to reduce repeated code for callers. This still allows callers to provide custom timer routines.

I added a few (non exhaustive) tests for the new additions.

It looks like there are a few pep8 improvements could be made to sched.py but I've not done that to reduce diffs and make it easier to see what I changed. Similar doc strings could be made more clear.

I snuck in a hack to the test so that the full test suite isn't needed, I do not expect that to be accepted :-) I don't have enough network bandwidth to pull the whole hg repo so I ended up pulling the tip version for 2.7 of sched and its test (as of 2011-10-22 this is 5110d723fbb1)
msg146181 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2011-10-22 19:08
Hi, thanks for the patch!
2.7 receives only bug fixes, so your patch can't be applied to 2.7.
If the feature is accepted it can go to 3.3 though.
msg148093 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2011-11-21 23:30
I think this should go in.
I'm going to provide a slighly modified version of the attached patch which includes document changes and get rid of some unit tests which are not really necessary in my opinion.
msg148094 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2011-11-21 23:39
Updated patch in attachment.
msg148109 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2011-11-22 12:12
+1 to kwargs support in sched.  I've also ended up modifying sched.py to support this in the past.
msg148112 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2011-11-22 12:40
Checked in as f1a21f2e3bec and dc52db0fa2e5.
Thanks.
History
Date User Action Args
2011-11-22 12:40:12giampaolo.rodolasetstatus: open -> closed
resolution: fixed
messages: + msg148112
2011-11-22 12:12:49mark.dickinsonsetnosy: + mark.dickinson
messages: + msg148109
2011-11-21 23:39:26giampaolo.rodolasetfiles: + issue13245.patch

messages: + msg148094
2011-11-21 23:30:40giampaolo.rodolasetnosy: + giampaolo.rodola
messages: + msg148093
2011-10-22 19:08:44ezio.melottisetversions: + Python 3.3, - Python 2.7
nosy: + ezio.melotti

messages: + msg146181

stage: patch review
2011-10-22 19:05:53clach04create