A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-August/048513.html below:

[Python-Dev] Re: What is PEP309?

[Python-Dev] Re: What is PEP309?Peter Harris scav at blueyonder.co.uk
Tue Aug 31 21:38:46 CEST 2004
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

More information about the Python-Dev mailing list

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