[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.
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