[Python-Dev] Update PEP 292 (original) (raw)

Barry Warsaw barry at python.org
Wed Aug 11 00:42:51 CEST 2004


Raymond and I had a chance to talk about PEP 292 on bug day, and we've exchanged a few private emails and implementations. I think we've finally knocked everything into shape for inclusion in Python 2.4's next alpha.

In the sandbox you will find the updated implementation, along with updated tests and documentation (libstring.tex).

The updated PEP is at:

http://www.python.org/peps/pep-0292.html

A summary of the most important changes:

  * Renamed 'dstring' to 'template', and removed the other ?string
    classes
  * Added a 'safe_template' subclass for non KeyError-throwing
    substitutions
  * Got rid of safedicts; Raymond figured out the trick to retain
    optional braces in the safe substitution case without needing
    that class.
  * Renamed the 'cre' class attribute for subclasses to 'pattern'

Now for the controversial bit .

I still think it's worthwhile to turn the string module into a package. The sandbox has an implementation of this that is completely backward compatible. I like it because it segregates the deprecated functions into a separate sub-module and makes the whole shebang easier to maintain. It also provides an existing namespace for future expansion, as has been discussed before.

Please note: PEP 292 is not dependent on the string module -> package reorganization, so it isn't documented in that PEP. I don't think it's worth writing a PEP just for this library reorganization. Take a look at the sandbox if you're interested.

http://cvs.sourceforge.net/viewcvs.py/python/python/nondist/sandbox/string/

As far as this aspect of the changes go, I would like BDFL pronouncement on it. I'll abide by Guido's decision here. If he nixes the re-org, then I propose to put the template and safe_template classes in Lib/string.py. The libstring.tex changes will still be relevant.

-Barry

-------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 307 bytes Desc: This is a digitally signed message part Url : http://mail.python.org/pipermail/python-dev/attachments/20040810/15fbe4b9/attachment.pgp



More information about the Python-Dev mailing list