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).
_ below follow not simulation
abort beyond following of simulator
above bottom from offset steps
additive can front override take
after case heading param terminate
ahead choose implies past top
along compose initial position toward
altitude contained interrupt precondition type
always deg intersects record visible
angle directly invariant relative wait
apparent distance left right when
apparently dynamic match scenario workspace
away ego model seconds
back eventually monitor see
behavior facing mutate setup
behind final next shuffle
Builtin Names
The following names are built into Scenic and can be used but not overwritten .
float globalParameters int str