Skip to main content
Baretta has a code style that we call the Baretta Rules. It adds two main things to Python: required types and pointers.

Types must be declared

In normal Python, parameters can be anything, and a function can return anything.
In Baretta, the types of the parameters and the return value must be known.
Both lines above are rejected. A correct version looks like this:
If a function has no declared return type, it returns None by default.

Pointers

In normal Python, a function cannot change a string that you pass in. The += below creates a new string inside the function, and the original v stays the same.
default in baretta every dynamic type thrown is a pointer, same as list and dict in normal python.
for small static data types with small memory they are set immutable.