Types Intro

arc uses argument type hints for data validation / conversion. For example, say we want to write a command that can sum two numbers together:

import arc

def add(val1: int, val2: int):
    arc.print(f"The answer is: {val1 + val2}")


$ python add.py 5 10
The answer is: 15
if the input fails to validate, arc will report a user-friendly error for the type
$ python add.py 5 not-a-number
    add.py [-h] val1 val2

invalid value for val2: must be an integer (invalid literal for int() with base 10: 'not-a-number')


if a parameter does not specify a type, arc implicitly types it as str.