Jon Harrop a écrit :
> Just debating somewhere else whether or not Python might be considered a
> functional programming language. Lua, Ruby and Perl all seem to provide
> first class lexical closures.
def makeadder(x):
def add(y):
return x+y
return add
If that's what you mean, then it a common idiom in Python, yes. You may
also want to look for 'function decoators' (some syntactic sugor for
HOFs), and how to define your own callable types (which is just the OO
equivalent to closures).
--
http://mail.python.org/mailman/listinfo/python-list