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.
Logged In: YES user_id=80475 The previous comment was just information. I am +1 on the proposal because the use case is so common and the proposed form is concise, clear, and natural.