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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4