From 4ea4f22e89e38775fb0436d2c34bf5e0cf1ecfb4 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 14 Jan 2016 20:41:16 +0000 Subject: Remove some unnecessary parens from Python output --- README.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'README.md') diff --git a/README.md b/README.md index 03e2ff4..bd19263 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,30 @@ two overloads -- one for the supertype, one for the subtype. This needs doing regardless of changes to boxing/unboxing primitives since - we currently use raw strings rather than boxing them into Java strings. \ No newline at end of file + we currently use raw strings rather than boxing them into Java strings. + +## Python precedence + +The table below gives precedence from lowest to highest in Python 3.5. +Some rows have the same precedence for serialisation to improve code +clarity. + +Operator | Precedence (serialisation) +---------|----------- +`lambda` | 0 +`if – else` | 10 +`or` | 20 +`and` | 20 +`not x` | 40 +`in`, `not in`, `is`, `is not`, `<`, `<=`, `>`, `>=`, `!=`, `==` | 50 +`|` | 60 +`^` | 70 +`&` | 80 +`<<`, `>>` | 90 +`+`, `-` | 100 +`*`, `@`, `/`, `//`, `%` | 110 +`+x`, `-x`, `~x` | 120 +`**` | 130 +`await x` | 140 +`x[index]`, `x[index:index]`, `x(arguments...)`, `x.attribute` | 150 +`(expressions...)`, `[expressions...]`, `{key: value...}`, `{expressions...}`` | 160 \ No newline at end of file -- cgit v1.2.3