Addition to slice syntax (for strings)

Max M maxm at mxm.dk
Mon Sep 13 14:11:15 EDT 2004


Will McGugan wrote:

> I have actually implemented something similar in a C++ string class, so 
> its not completely crazy - but I would be interested in what more 
> experienced Python developers think of it.

I actually find that it is a good idea for a class, but the devil is in 
the details, and I think that it might be too limited in the long run.

Sometimes you want to use rfind() instead of find(). Other times you 
want to use a regular expression as the index etc.

It is probably a good idea to leave it out of the language. Especially 
as it is pretty easy to roll your own.

A better idea is to add the recipe to the Python Cookbook

http://aspn.activestate.com/ASPN/Python/Cookbook/

regards Max M



More information about the Python-list mailing list