[Python-Dev] [Python-checkins] r46795 - in python/trunk: Doc/lib/libstdtypes.tex Lib/test/string_tests.py Misc/NEWS Objects/stringobject.c Objects/unicodeobject.c
Neal Norwitz
nnorwitz at gmail.com
Tue Jun 13 09:38:42 CEST 2006
More information about the Python-Dev mailing list
Tue Jun 13 09:38:42 CEST 2006
- Previous message: [Python-Dev] [Python-checkins] r46795 - in python/trunk: Doc/lib/libstdtypes.tex Lib/test/string_tests.py Misc/NEWS Objects/stringobject.c Objects/unicodeobject.c
- Next message: [Python-Dev] xrange vs. int.__getslice__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 6/13/06, Tim Peters <tim.peters at gmail.com> wrote: > [georg.brandl] > >> Author: georg.brandl > >> Date: Fri Jun 9 20:45:48 2006 > >> New Revision: 46795 > >> > >> Log: > >> RFE #1491485: str/unicode.endswith()/startswith() now accept a > tuple as first argument. > > [Neal Norwitz] > > What's the reason to not support any sequence and only support tuples? > > It can't support any sequence, else e.g. s.endswith(".py") would be ambiguous. Good point, I was really just thinking of lists though. > > Are there any other APIs that only support tuples rather than all > > sequences? > > Oh, who cares -- it would be a relief to leave _something_ simple <0.7 > wink>. :-) I was thinking about a use case like this: supported_suffixes = ['.py', '.pyc', '.pyo'] if sys.platform[:3] == 'win': supported_suffixes.append('.pyw') if pathname.endswith(supported_suffixes): # ... I realize you could just throw a tuple(supported_suffixes). I don't know that I've ever needed that specific use case. I don't think it's too common. Just thinking about avoiding newbie surprises. > Given that {start,end}swidth can't support all sequences regardless, > restricting it to tuples is OK by me, and was clearly sufficient for > the uses made of this already in the standard library. I'm ok with this either way. It's easy enough to add later, but hard to take away. n
- Previous message: [Python-Dev] [Python-checkins] r46795 - in python/trunk: Doc/lib/libstdtypes.tex Lib/test/string_tests.py Misc/NEWS Objects/stringobject.c Objects/unicodeobject.c
- Next message: [Python-Dev] xrange vs. int.__getslice__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list