nested scopes
Michael Hudson
mwh21 at cam.ac.uk
Tue Feb 6 10:55:53 EST 2001
Martin von Loewis <loewis at informatik.hu-berlin.de> writes:
> Robin Becker <robin at jessikat.fsnet.co.uk> writes:
>
> > Is it really true that J Hylton's nested scopes will cause code like
> >
> > def bingo():
> > from string import *
> > ....
> >
> > to be declared bad?
>
> That code has been bad for a long time. See
>
> http://www.python.org/doc/current/ref/import.html
>
> which says
>
> # The from form with "*" may only occur in a module scope.
>
> It is only now that this restriction is enforced by CPython; again,
> the code was incorrect for a long time (see
>
> http://www.python.org/doc/1.4/ref/ref6.html#REF17806
>
> to get my point; it was also in the 1.1 version of the language
> reference).
I've been meaning to say this for a few days, but finally I get round
to saying that this particular argument bothers me; Python isn't a
language you program with a reference manual open at all times
(unlike, say, C++) - and this IMHO is a good thing. This particular
change probably isn't too stressful, but I slightly fear more onerous
restrictions might be lurking in the ref manual to be whipped out when
we next get comfortable with the language.
Cheers,
M.
--
(Of course SML does have its weaknesses, but by comparison, a
discussion of C++'s strengths and flaws always sounds like an
argument about whether one should face north or east when one
is sacrificing one's goat to the rain god.) -- Thant Tessman
More information about the Python-list
mailing list