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

Fred .Flintstone report at bugs.python.org
Tue Feb 5 04:38:53 EST 2019


Fred .Flintstone <eldmannen at gmail.com> 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 <report at bugs.python.org>
<https://bugs.python.org/issue35897>
_______________________________________


More information about the Python-bugs-list mailing list