how to write function that returns function

Paul Graham spam at bugbear.com
Wed May 15 12:15:53 EDT 2002


Thanks to everyone who replied to my earlier question.  It seems
Python scope rules have changed recently, and my info was out of 
date.  I am still uncertain about a couple things though: there
seem to be some restrictions on what you can do with lexical
variables and also what you can put in a lambda.  Can some Python
expert tell me how you would express the Common Lisp

(defun foo (n) #'(lambda () (incf n)))

in Python?

Many thanks,  --pg



More information about the Python-list mailing list