New submission from Elizabeth Myers:

str.startswith and str.endswith should accept multiple arguments when passing 
in strings. This makes it easier to check if the first character of a string is 
one of a given option, versus this awkward construction:

>>> f = 'abc'
>>> 'test'.startswith(tuple(f))
False

With my proposal, this could be shortened to 'test'.startswith(*f) for easy 
testing.

This also makes it easier to check if a string begins with one of any 
combination of matches.

----------
components: Interpreter Core, Unicode
messages: 241912
nosy: Elizacat, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: str.startswith and str.endswith should accept multiple arguments.
type: enhancement
versions: Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24047>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to