Feature Requests item #1491485, was opened at 2006-05-19 10:24
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1491485&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Tom Lynn (tlynn)
Assigned to: Nobody/Anonymous (nobody)
Summary: str.startswith/endswith could take a tuple?
Initial Comment:
In the same way that exceptions can have a tuple of
types specified and isinstance can take a tuple of
types, str.startswith and endswith could take a tuple
of possible prefixes/suffixes.
One use-case::
if filename.endswith(('jpg', 'gif', 'png')):
# ...
vs:
if (filename.endswith('jpg') or filename.endswith
('gif') or
filename.endswith('png')):
#...
Obviously it's not a huge improvement in clarity, but
it does seem to be an improvement to me.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1491485&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com