Python operator precedence (priority)

LOWEST

  1. lambda
  2. ifelse
  3. or
  4. and
  5. not x
  6. in, not in, is, is not, <, <=, >, >=, !=, ==
  7. |
  8. ^
  9. &
  10. <<, >>
  11. +, -
  12. *, /, //, %
  13. +x, -x, ~x
  14. **
  15. x[index], x[index:index], x(arguments...), x.attribute
  16. (expressions...), [expressions...], {key: value...}, {expressions...}

HIGHEST

On same line priority is equel so such operators executed from left to right.

#python
1
Ivan Borshchov profile picture
Dec 05, 2016
by Ivan Borshchov
Did it help you?
Yes !
No

Best related