[issue43134] (list have item) instate (item in list)

Dennis Sweeney report at bugs.python.org
Fri Feb 5 12:55:26 EST 2021


Dennis Sweeney <sweeney.dennis650 at gmail.com> added the comment:

You could express this as:

a = [input() for i in range(10)]
x = input()
print(x in a)

This is more clear IMO, because if you want to have something happen before something else, it's clearest to put them on separate lines, one after the other.

I also don't like using "a have x" to duplicate the behavior of "x in a", because,
per PEP 20: "There should be one-- and preferably only one --obvious way to do it."

----------
nosy: +Dennis Sweeney

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


More information about the Python-bugs-list mailing list