[Python-Dev] Extended Function syntax

Samuele Pedroni pedronis@bluewin.ch
Sun, 2 Feb 2003 17:25:43 +0100


From: "Guido van Rossum" <guido@python.org>
> > > What are the scope rules for blocks passed into method calls in
> > > Smalltalk?
> >
> > they are not ambiguous in the sense we are referring here:
> >
> > def f():
> >   x=3
> >   foo:
> >     x=4 # new x or old x?
>
> OK, so what are the rules in Smalltalk?  Could we use the same rules
> in Python?

in (modern) Smalltalk blocks introduce a new scope and are closures with
rebinding ability. Nothing to copy from there.

In Python inline-suites do not introduce a new-scope, functions introduce a new
scope and closure but without rebinding, 'class' introduces a new-scope. I
really think that the cases should be syntactically separated.