string interpolation syntactic sugar

Greg Ewing greg.ewing at compaq.com
Mon Dec 13 08:43:27 EST 1999


hartmut Goebel wrote:
> 
> I suppose, local() generates a new tuple. This may be quite unefficient.

A dictionary, actually.

After I posted my suggestion, it occurred to me that the unary %
operator should search both the local and global namespaces.
This could be done without creating any temporary dictionaries --
just do a normal name lookup in the current scope. It would
also give you something more than just syntactic sugar, since
this is quite awkward to express using the currently available
language features.

Greg



More information about the Python-list mailing list