[Python-Dev] String methods... finally

Tim Peters tim_one at email.msn.com
Fri Jun 11 05:33:25 CEST 1999


> Two new methods startswith and endswith act like their Java cousins.

Barry, suggest that both of these grow optional start and end slice indices.
Why?  It's Pythonic <wink>.  Really, I'm forever marching over huge strings
a slice-pair at a time, and it's important that searches and matches never
give me false hits due to slobbering over the current slice bounds.  regexp
objects in general, and string.find/.rfind in particular, support this
beautifully.  Java feels less need since sub-stringing is via cheap
descriptor there.  The optional indices wouldn't hurt Java, but would help
Python.

then-again-if-strings-were-so-great-i'd-switch-to-tcl<wink>-ly y'rs  - tim






More information about the Python-Dev mailing list