Skip to main content
Removed some misleading stuff
Source Link
khelwood
  • 59.7k
  • 14
  • 91
  • 116

Despite lots of arguments to the contrary,

6 and 1 in lis 

means

6 and (1 in lis) 

It does not mean:

(6 and 1) in lis 

The page that Maroun Maroun linked to in his comments indicates that and has a lower precedence than in, so the in will be evaluated first.

You can test it like this:

0 and 1 in [0] 

If this means (0 and 1) in [0] then it will evaluate to true, because zero0 is in [0].

If it means 0 and (1 in [0]) then it will evaluate to zero0, because 0 is false.

It evaulatesevaluates to zero0.

Despite lots of arguments to the contrary,

6 and 1 in lis 

means

6 and (1 in lis) 

It does not mean:

(6 and 1) in lis 

The page that Maroun Maroun linked to in his comments indicates that and has a lower precedence than in, so the in will be evaluated first.

You can test it like this:

0 and 1 in [0] 

If this means (0 and 1) in [0] then it will evaluate to true, because zero is in [0].

If it means 0 and (1 in [0]) then it will evaluate to zero, because 0 is false.

It evaulates to zero.

Despite lots of arguments to the contrary,

6 and 1 in lis 

means

6 and (1 in lis) 

It does not mean:

(6 and 1) in lis 

The page that Maroun Maroun linked to in his comments indicates that and has a lower precedence than in.

You can test it like this:

0 and 1 in [0] 

If this means (0 and 1) in [0] then it will evaluate to true, because 0 is in [0].

If it means 0 and (1 in [0]) then it will evaluate to 0, because 0 is false.

It evaluates to 0.

Source Link
khelwood
  • 59.7k
  • 14
  • 91
  • 116

Despite lots of arguments to the contrary,

6 and 1 in lis 

means

6 and (1 in lis) 

It does not mean:

(6 and 1) in lis 

The page that Maroun Maroun linked to in his comments indicates that and has a lower precedence than in, so the in will be evaluated first.

You can test it like this:

0 and 1 in [0] 

If this means (0 and 1) in [0] then it will evaluate to true, because zero is in [0].

If it means 0 and (1 in [0]) then it will evaluate to zero, because 0 is false.

It evaulates to zero.