Suggestions for python 2

bjorn bjorn at roguewave.com
Tue Jan 18 16:14:30 EST 2000


Evan Simpson wrote:

> Bernhard Herzog <herzog at online.de> wrote in message
> news:m3embfz6p5.fsf at greebo.nodomain.de...
> > > Edward Welbourne <eddy at vortigen.demon.co.uk> writes:
> > [snip]
> > > > Three new kinds of argument come into being (with my given spelling):
> > > >   * safe tunnel: after both * and **
> > > >   * keyword-only: after * but not **
> > > >   * positional-only: after ** but not *
> [objections to proposal]
> >
> > I'll second that. Turning a kludge that works because of an
> > implementation detail into an officially supported feature isn't a good
> > idea, IMO. Support for lexical scoping is the correct approach.
> [snip]
> > lexical scoping would take care of that, unless I'm missing something.
>
> Now that two people have asserted that lexical scoping is the right way to
> handle this, I'd like to know what they *mean* by lexical scoping.
>
> How would names get bound to (or just initialized from?) names in lexically
> enclosing scopes?  Implicitly? Explicitly?
> Would we still declare module-global variables, or would they use the same
> mechanism as names in intermediate scopes?
>
> I rather like the idea of having to explicitly bring names into an inner
> scope, and with semantics identical to parameter defaults.  Why is this so
> objectionable?  Is it just the syntax?

Yes, and it's ugly <wink>  It also leads to special casing of recursion:

    def foo():
        def bar():
            bar() # oops, I don't know who I am...

while Python's scoping rules are simple, they're definitely not intuitive.  I
think the best solution would be to make them simple and intuitive -- which
leads to implicit access to variables defined in an enclosing scope.

-- bjorn





More information about the Python-list mailing list