(a & b):
What happens with logical and? If a is false, does python evaluates b or not?
No. Here's the code I just used to check this:
>>> def a():
... print 'a'
... return False
...
>>> def b():
... print 'b'
... return True
...
>>> a() and b()
a
False
>>> b() and a()
b
a
False
>>>
jlm699
Veteran Poster
1,112 posts since Jul 2008
Reputation Points: 355
Solved Threads: 292
The logical and in python is the and operator, not the & which is bitwise and.
Gribouillis
Posting Maven
2,781 posts since Jul 2008
Reputation Points: 1,024
Solved Threads: 691