[Python-Dev] PEP 292, Simpler String Substitutions

Guido van Rossum guido@python.org
Wed, 19 Jun 2002 08:54:56 -0400

> >     - We can simply allow the exception (likely a NameError or
> >       KeyError) to propagate.
> Explicit!
> >     - We can return the original substitution placeholder unchanged.
> Silently guess???

I'm strongly in favor of always making missing keys an error.  It
should be a KeyError when a dict is used, and a NameError when
locals/globals are looked up.

> Overall it isn't bad...it's a little weird to have a method that depends
> on sys._getframe(1) (or as the say in Tcl-land "upvar"). It may set a
> bad precedent...

No, the real implementation will be in C.  C functions always have
access to locals and globals.

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