[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
Tim Peters
tim.peters at gmail.com
Tue Jun 13 09:24:41 CEST 2006
More information about the Python-Dev mailing list
Tue Jun 13 09:24:41 CEST 2006
- Previous message: [Python-Dev] DRAFT: python-dev summary for 2006-04-16 to 2006-04-30
- Next 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
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[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.
> 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>. It's a bit of a stretch, but, e.g.,
>>> isinstance(1, [int, str])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: isinstance() arg 2 must be a class, type, or tuple of
classes and types
is restricted to tuple containers; ditto issubclass. They're similar
in that most expected uses involve small, constant collections.
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.
- Previous message: [Python-Dev] DRAFT: python-dev summary for 2006-04-16 to 2006-04-30
- Next 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
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list