Aahz wrote:
What's PEP309?
(People reading python-dev do not all have all PEP numbers memorized, and it's not reasonable to expect everyone to go look them up when it would take you only a few moments to save everyone else time.)
OK, sorry about that. PEP309 is for a class that emulates partial function application (a bit like currying in languages that do it that way, but not exactly). It lets you make callable wrappers round a callable object, with some arguments 'frozen in'. #e.g. classes and functions can both be used: win = Tkinter.Tk() # my window blueButn = partial(Tkinter.Button, win, fg='blue') # factory for blue buttons in my window def callback(name): print name,"pressed" b1 = blueButn(text="Hello", command=partial(callback,"hello")) b2 = blueButn(text="Goodbye", command=partial(callback,"goodbye")) The PEP proposes a module 'functional' for stuff (like partial) that operates on or returns other functions. I expect there are a few things that might belong there, but only 'partial' is in the proposal. Peter Harris
participants (1)
-
Peter Harris