A RetroSearch Logo

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

Search Query:

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

[Python-Dev] PEP 292, Simpler String Substitutions

[Python-Dev] PEP 292, Simpler String Substitutions [Python-Dev] PEP 292, Simpler String SubstitutionsPaul Prescod paul@prescod.net
Tue, 18 Jun 2002 21:46:33 -0700
"Barry A. Warsaw" wrote:
> 
>...
    The mapping argument is optional; if it is omitted then the
>     mapping is taken from the locals and globals of the context in
>     which the .sub() method is executed.  For example:
> 
>         def birth(self, name):
>             country = self.countryOfOrigin['name']
>             return '${name} was born in ${country}'
> 
>         birth('Guido')

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

>...

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

Explicit!

>     - We can return the original substitution placeholder unchanged.

Silently guess???

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...

 Paul Prescod




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