Michael Hudson wrote:
> partition() works for me.  It's not perfect, but it'll do.  The idea
> works for me rather more; it even simplifies the 
> 
> if s.startswith(prefix):
>     t = s[len(prefix):]
>     ...

How would you do it? Something like:

   head, found, tail = s.partition(prefix)
   if found and not head:
     ...

I guess I agree that's an improvement - only a slight one, though.

Cheers,
Nick.

-- 
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.blogspot.com
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to