diff --git a/porting-code-to-python-3-with-2to3.html b/porting-code-to-python-3-with-2to3.html index f437601..47c0236 100644 --- a/porting-code-to-python-3-with-2to3.html +++ b/porting-code-to-python-3-with-2to3.html @@ -175,10 +175,10 @@ h3:before{counter-increment:h3;content:'A.' counter(h2) '.' counter(h3) '. '}
in operator takes precedence over the or operator, so there is no need for parentheses around (x in a_dictionary) or around (y in a_dictionary).
-(x or y) here, for the same reason — in takes precedence over or. (Note: this code is completely different from the previous line. Python interprets x or y first, which results in either x (if x is true in a boolean context) or y. Then it takes that singular value and checks whether it is a key in a_dictionary.)
-in operator takes precedence over the + operator, so this form technically doesn’t need parentheses around (x + y), but 2to3 includes them anyway.
-(y in a_dictionary), since the in operator takes precedence over the + operator.
+in operator takes precedence over the or operator, so there is no need for parentheses around x in a_dictionary or around y in a_dictionary.
+x or y here, for the same reason — in takes precedence over or. (Note: this code is completely different from the previous line. Python interprets x or y first, which results in either x (if x is true in a boolean context) or y. Then it takes that singular value and checks whether it is a key in a_dictionary.)
+in operator takes precedence over the + operator, so this form technically doesn’t need parentheses around x + y, but 2to3 includes them anyway.
+y in a_dictionary, since the in operator takes precedence over the + operator.