A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2002-June/025604.html below:

[Python-Dev] PEP 292, Simpler String Substitutions

[Python-Dev] PEP 292, Simpler String SubstitutionsGuido van Rossum guido@python.org
Wed, 19 Jun 2002 10:50:59 -0400
> > BTW, you can't use locals() or globals() because you really want
> > globals()-overridden-with-locals(), i.e.
> > 
> >     d = globals().copy()
> >     d.update(locals())
> 
> What about free/cell vars?  Will these be used?  
> If not, is that a problem?

Without compiler support for this construct we have no hope of getting
references to outer non-global scopes right.  E.g.

def f():
    x = 12

    def g():
        return "x is $x".sub()

    return g

Here the compiler has no clue that g references x, so it wouldn't do
the special treatment for x that's needed to make it work.

I see no way to fix this in general without introducing new syntax;
note that the string "x is $x" could have been an argument to g().

--Guido van Rossum (home page: http://www.python.org/~guido/)




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4