[issue35897] Support list as argument to .startswith()

2019-02-05 Thread Fred .Flintstone


New submission from Fred .Flintstone :

The "".startswith() method accepts a string or a tuple as a parameter.

Consider adding support for list as parameter.

Example:
"foo".startswith(["food", "for", "fast"])

--
components: Interpreter Core
messages: 334856
nosy: Fred .Flintstone
priority: normal
severity: normal
status: open
title: Support list as argument to .startswith()
type: enhancement
versions: Python 3.6

___
Python tracker 
<https://bugs.python.org/issue35897>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35897] Support list as argument to .startswith()

2019-02-05 Thread Fred .Flintstone


Fred .Flintstone  added the comment:

A programmer want to instruct the computer to do something, without having to 
care about how it works.

Maybe the library could in the background convert the list to a tuple.

Like:
"foo".startswith(tuple(["food", "for", "fast"]))

But the programmer shouldn't have to worry about this. I have a list, I want to 
use the list. I shouldn't have to care about interpreter internals that have 
nothing to do with the intent of my code.

My code should clearly represent intent, not have boilerplate code or 
constructs to workaround interpreter internals.

--

___
Python tracker 
<https://bugs.python.org/issue35897>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com