A certainl part of an if() structure never gets executed.

Chris Angelico rosuav at gmail.com
Thu Jun 13 00:39:01 EDT 2013


On Thu, Jun 13, 2013 at 2:35 PM, Kushal Kumaran
<kushal.kumaran+python at gmail.com> wrote:
> In [4]: 'cd' in s1 or 'cd' in s2 or 'cd' in s3
> Out[4]: False
>
> In [5]: 'cd' in s1+s2+s3
> Out[5]: True

That's why I said it works for *character* in string, not *string* in
string. If your first operand is a single character (which in Python
is still of type 'str'), then the equivalency holds.

ChrisA



More information about the Python-list mailing list