[Python-Dev] Re: anonymous blocks vs scope-collapse

Paul Moore p.f.moore at gmail.com
Tue Apr 26 23:40:27 CEST 2005


On 4/26/05, Jim Jewett <jimjjewett at gmail.com> wrote:
> I'm not sure I understand this.  The preferred way would be
> to just stick the keyword before the call.  Using 'collapse', it
> would look like:
> 
>     def foo(b):
>         c=a
>     def bar():
>         a="a1"
>         collapse foo("b1")
>         print b, c        # prints "b1", "a1"
>         a="a2"
>         foo("b2")        # Not collapsed this time
>         print b, c        # still prints "b1", "a1"

*YUK* I spent a long time staring at this and wondering "where did b come from?"

You'd have to come up with a very compelling use case to get me to like this.

Paul.


More information about the Python-Dev mailing list