None
False
- Zero of any numeric type (0, 0.0)
- Empty strings -
''
- Empty sequences -
[]
,()
- Empty mapping -
{}
- x
and
y - x
or
y not
x
Operator | Meaning |
---|---|
< | strictly less than |
<= | less than or equal |
> | strictly greater than |
>= | greater than or equal |
== | equal |
!= | not equal |
is | object identity |
is not | negated object identity |
- int
- 32 bits of precision
- float
- Numeric literals with a decimal point
- long
- Integers have unlimited precision
- Suffixed with
L
orl
, useL
to avoid confusion with the number 1
- complex
- Suffixed with
J
orj
- Suffixed with
- Enclosed in either single or double quotes
- Can be prefaced with
u
for unicode strings (u'abc'
,u"def"
) - Splicing
- len()
- Enclosed in square brackets
[a, b, c]
- Optionally enclosed in parentheses
a, b, c
or(a, b, c)
- Empty tuples must have parentheses
()
- A single tuple value must have a trailing comma
(a,)