[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-3000
Subject:    Re: [Python-3000] Lexical variables at last!
From:       skip () pobox ! com
Date:       2007-12-29 11:46:57
Message-ID: 18294.13233.689037.298202 () montanaro ! dyndns ! org
[Download RAW message or body]


    Rocco> However, I've also tried this:

    Rocco> def accumulator(n):
    Rocco>     return lambda x: nonlocal n = n + x

    Rocco> and unfortunately it gave me a syntax error. I don't see any
    Rocco> reason why this kind of code should not be possible.

    Rocco> What do you all think?

Lambdas only support a single expression, not statements and that's not
going to change in 3.0.

Skip
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: http://mail.python.org/mailman/options/python-3000/python-3000%40progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic