I'm looking for resources to help me with a fn that returns a fn after
binding one of its arguments (aka currying, like the bind1st of C++)

Considering Python syntax is quite straightforward, this is my first try:

def getjlistrenderer(opname):
        def listrender():
                # use opname, eg ops=getlist(opname)
                # or set local fn variable
                return renderer;
        return listrender;
        #?or f=listrender(); return f;

Is it really as simple as this? Or will I always return the same function
definition? I need it to return a 'new' function for each call to
getjlistrender() .. do I need to create a new fn with f=listrender() ?

Any pointers to pages/books etc. appreciated. I am looking through my
books too, but thought I'd get some more pointers as well. Web searching
so far only shows lambda, which is one-liner, and that won't do.

Thanks!
-- 
Nandan Bagchee


We need a language that lets us scribble and smudge and smear, not a language
where you have to sit with a teacup of types balanced on your knee and make
polite conversation with a strict old aunt of a compiler.

                -- Paul Graham

_______________________________________________
Tutor maillist  -  [EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to