String wrapper?

Thomas Wouters thomas at xs4all.nl
Mon Jun 26 03:35:55 EDT 2000


On Sun, 25 Jun 2000 23:44:24 -0800, Matthew Cline <matt at nightrealms.com> wrote:
>Is there any way to make a wrapper for a string object,
>like UserDict is a wrapper for the dict type?

There is the UserString module in the 1.6 alphas, and it seems to be fairly
portable. (It defines all methods that strings have in 1.6, whereas they
have none in 1.5.2, but that shouldn't bother portability. You can't use
them unless you use 1.6 strings as well, though, because those methods are
defined in terms of string methods ;-)

You can get the UserString module by downloading a 1.6 alpha, or by grabbing
a recent CVS tree, or by browsing the CVS three through sourceforge:

http://www.sourceforge.net/cvs/?group_id=5470

The module should at least show that it's *possible* to write a string
wrapper ;-) though without the 1.6 additions to strings & the __contains__
overloader it might not be that efficient.

Regards,
Thomas.



More information about the Python-list mailing list