[Python-Dev] PEP 292 - simpler string substitutions
barry at python.org
Tue Mar 23 23:00:12 EST 2004
PEP 292 describes simpler string substitutions, i.e. $-strings. PEP 320
says that this is going into Python 2.4. I've had some code laying
around that implemented $-strings as a subclass of unicode instead of
what PEP 292 describes as a new string method. The advantage to this
approach is that the feature is provided with no language changes, or
changes to the existing string classes.
I've cleaned up my code and posted a patch to SF. I've also checked in
an updated PEP 292 that fits my implementation more closely. Please
review the PEP and the patch:
The reference implementation in the patch adds a couple of extra things
that aren't part of the PEP, but were discussed at Monday's sprint.
- a top level package called 'stringlib' is added to the standard
- the dstring class implemented PEP 292 is available through
- some handy dict subclasses that work with the dstring class are also
The idea was that some of the constants and functions we want to keep
from the string module would go in the stringlib package. That's not
essential to the PEP of course.
If this stuff is approved for Python 2.4, I'll add test cases and
More information about the Python-Dev