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

Rémi Lapeyre report at bugs.python.org
Tue Feb 5 13:20:03 EST 2019


Rémi Lapeyre <remi.lapeyre at henki.fr> added the comment:

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

This is not true, as a programmer you need to choose carefully your data structures because they matter, for example there is a difference between doing a lookup on an indexed field in an SQL database and a field that is not indexed. As a programmer you care because it impacts the performance of your application.

The linked discussion explains the difference between list and tuple in this instance.

@rhettinger: while this is not hard to fix, there is no mention in the documentation about why this choice has been made. A beginner don't know about the internals of cPython, should we add a small note about the optimization done with tuple?

----------
nosy: +remi.lapeyre

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35897>
_______________________________________


More information about the Python-bugs-list mailing list