[Python-Dev] PEP 292, Simpler String Substitutions

Barry A. Warsaw barry@zope.com
Wed, 19 Jun 2002 07:16:52 -0400


>>>>> "PP" == Paul Prescod <paul@prescod.net> writes:

    PP> You forgot the "implicit .sub"() feature.

Yup, thanks.

    >> ...

    >> - We can simply allow the exception (likely a NameError or
    >> KeyError) to propagate.

    PP> Explicit!

Now you're thinking like Guido! :)

    >> - We can return the original substitution placeholder
    >> unchanged.

    PP> Silently guess???

I'm beginning to agree that the exception should be raised.  I want to
be explicit about it so we can write the safedict wrapper effectively.
I agree that an exception is better when using the no-arg version, but
for the arg-version I /really/ want to be able to suppress all
interpolation exceptions, and just return some string, even if it has
placeholders still in it.

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

Noted.

Thanks,
-Barry