General Notes on Syntax
Keywords
Keywords
The following words are reserved by Scenic and cannot be used as identifiers (i.e. as names of variables, functions, classes, properties, etc.).
False break except lambda require
None by finally new return
True class for nonlocal to
and continue from not try
as def global of until
assert del if on while
async do import or with
at elif in pass yield
await else is raise
Soft Keywords
The following words have special meanings in Scenic in certain contexts, but are still available for use as identifiers. Users should take care not to use these names when doing so would introduce ambiguity. For example, consider the following code:
distance = 5 # not a good variable name to use here
new Object beyond A by distance from B
This might appear to use the three-argument form of the beyond
specifier, creating the new object at distance 5 beyond A
from the point of view of B
.
But in fact Scenic parses the code as beyond A by (distance from B)
, because the interpretation of distance
as being part of the distance from
operator takes precedence.
To avoid confusion, we recommend not using distance
, angle
, offset
, altitude
, or visible
as identifiers in code that uses Scenic operators or specifiers (inside pure-Python helper functions is fine).
_ behind facing mutate see
abort below final next setup
above beyond follow not shuffle
additive bottom following of simulation
after can from offset simulator
ahead case front override steps
along choose heading param take
altitude compose implies past terminate
always contained initial position top
angle deg interrupt precondition toward
apparent directly invariant record visible
apparently distance left relative wait
away dynamic match right when
back ego model scenario workspace
behavior eventually monitor seconds