the demise of 'from foo import * and its implications?
tim.one at home.com
Sat Mar 3 21:21:19 CET 2001
>>> If we really want to improve visibility we could try to make
>>> >>> def bingo(a):
>>> ... if a<=1: return 0
>>> ... return bingo(a-1)*a
>>> work naively, but I'm fairly sure this will be rejected as unpythonic or
>> In what sense doesn't this work now?
>>What doesn't work is the following:
>> def fact(a):
>> if a <= 1: return 1
>> else: return fact(a-1)*a
>> return fact(n) + 42
> you're right of course, this is what I meant. I haven't played with the
> new statically scoped stuff, but I probably wrongly assumed that bingo
> would remain invisible inside bingo.
Ah! Yes, that assumption is wrong. Making nested recursive functions "work"
as expected was one of the (few) strong *practical* arguments in favor of
> I hadn't really appreciated before now that python wishes to enforce a
> fixed scope for references (for optimisation purposes)
See other reply: "optimization" is incidental here. Python wants static
scoping *primarily* for sanity. Dynamic scoping is more error-prone because
More information about the Python-list