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

Chris Angelico rosuav at gmail.com
Wed Jun 12 22:03:53 EDT 2013


On Thu, Jun 13, 2013 at 11:55 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> In English:
>
> "the cat is in the box or the cupboard or the kitchen"
>
> means:
>
> "the cat is in the box, or the cat is in the cupboard, or the cat is in
> the kitchen".
>
>
> But that is not how Python works. In Python, you have to say:
>
> cat in box or cat in cupboard or cat in kitchen

Or you can deem that there be one single location that is the merging
of box, cupboard, and kitchen, and say:

cat in (box+cupboard+kitchen)

which works fine for character-in-string and element-in-list searches.

ChrisA



More information about the Python-list mailing list