diff --git a/porting-code-to-python-3-with-2to3.html b/porting-code-to-python-3-with-2to3.html index e40ceea..6f00ef4 100644 --- a/porting-code-to-python-3-with-2to3.html +++ b/porting-code-to-python-3-with-2to3.html @@ -177,8 +177,8 @@ h3:before{counter-increment:h3;content:'A.' counter(h2) '.' counter(h3) '. '}
  • The simplest form.
  • The 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.
  • On the other hand, you do need parentheses around 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.) -
  • The in operator takes precedence over the + operator, so this form technically doesn’t need parentheses around x + y, but 2to3 includes them anyway. -
  • This form definitely needs parentheses around y in a_dictionary, since the in operator takes precedence over the + operator. +
  • The + operator takes precedence over the in operator, so this form technically doesn’t need parentheses around x + y, but 2to3 includes them anyway. +
  • This form definitely needs parentheses around y in a_dictionary, since the + operator takes precedence over the in operator.

    Dictionary methods that return lists