[Python-Dev] String methods... finally

M.-A. Lemburg mal at lemburg.com
Fri Jun 11 16:55:14 CEST 1999


Guido van Rossum wrote:
> 
> > > > Two new methods startswith and endswith act like their Java cousins.
> > >
> > > is it just me, or do those method names suck?
> 
> It's just you.
> 
> > > begin?  starts_with?  startsWith? (ouch)
> > > has_prefix?
> 
> Those are all painful to type, except "begin", which isn't expressive.
> 
> > In mxTextTools I used the names prefix() and suffix() for much
> 
> The problem with those is that it's arbitrary (==> harder to remember)
> whether A.prefix(B) means that A is a prefix of B or that A has B for
> a prefix.

True. These are functions in mxTextTools and take a sequence
as second argument, so the order is clear there... has_prefix()
has_suffix() would probably be appropriate as methods (you don't
type them that often ;-)

-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                   203 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/





More information about the Python-Dev mailing list