Raymond Hettinger <[email protected]> added the comment:
> Teammate of mine tripped up against this because he tried to use a list.
Then, I recommend we close this. Accepting a list would have encouraged
inefficient code (a tuple of constants can be peephole optimized but a list of
constants is rebuilt on every call). Also, the error message is very clear, so
it is unlikely he was "tripped-up" for more than a few seconds.
>>> 'hello'.startswith(['he', 'go'])
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
'hello'.startswith(['he', 'go'])
TypeError: startswith first arg must be str or a tuple of str, not list
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34312>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com