A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-June/066013.html below:

[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

[Python-Dev] [Python-checkins] r46795 - in python/trunk: Doc/lib/libstdtypes.tex Lib/test/string_tests.py Misc/NEWS Objects/stringobject.c Objects/unicodeobject.cTim Peters tim.peters at gmail.com
Tue Jun 13 09:24:41 CEST 2006
[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.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4