[Python-ideas] Tweaking closures and lexical scoping to include the function being defined
hetchkay at gmail.com
Tue Sep 27 07:01:42 CEST 2011
Since the expression will not be evaluated in the body of the function,
would it make sense to define it outside the function body:
def FUNC() given VAR1 [= EXPR1], VAR2 [= EXPR2]:
# Do stuff with VAR1, VAR2
VAR1, VAR2 etc. will be evaluated in order so that EXPR2 can refer to VAR1.
Values of VAR1, VAR2 etc. are preserved across function calls. This will be
similar to scheme's let:
(define func (let ((var1 expr1) (var2 expr2)) (lambda () <body> )))
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas