Supported Python Statements
Your statements and expressions are going to be statically typechecked, so that your supplied type hints correspond to the operations you are performing.
Dictionary updates
Updating or creating a dictionary entry is performed using a standard indexed assignment statements (note that type hint is still necessary). To remove a key from a dictionary, the standard del statement is also supported:
def receive_Move(self, i : int):
temp : int = self.mymap[i]
del self.mymap[i]
self.mymap[i+1] : int = tempBranching
The if/elif/else branching statements can be used to control the execution flow. The if test must have the boolean type. Empty return statements can be used to break out of the receive methods:
def receive_Withdraw(self, amount : int):
if amount < 100:
self.balance : int = self.balance - amount
return
self.balance : int = self.balance - 100Validation methods must return boolean values and standalone functions must return the values of the provided type hint:
def validate_Withdraw(self, amount : int):
if amount < 1:
return False
elif amount > self.balance:
return False
return TrueAssignment Statements
Assignment statements are the most basic Python tatements allowed in method and function declarations. You can either assign to a self attribute (which must be initialized in the __init__ constructor method), or some local variable:
def receive_Action(self, x : int):
temp : int = self.x
self.x : int = 2
temp : int = temp + x Each assignment statement must provide the type of the assignment target. Since augmented assignments cannot be type- annotated, they are not allowed.