Skip to main content
Most Sifr programs use familiar Python-shaped values: numbers, strings, None, lists, dictionaries, tuples, and sets. The difference is that every value has a compile-time type and every missing-value path is visible in that type.

Scalars

int is the source-level integer you reach for by default. Use explicit fixed-width integer types when storage layout, binary protocols, FFI, or dtype-sensitive work requires a specific representation: int8, int16, int32, int64, uint8, uint16, uint32, uint64, isize, and usize.

Optional Values

Use T | None when a value might be absent. Sifr requires you to check None before using the inner value.
Dictionary and sequence operations that can miss use this same shape.

Lists

Lists are ordered, mutable collections.
Mutating a list through a function parameter requires mut.
For the full parameter model, see Ownership and Mutability.

Dictionaries

Dictionaries map keys to values. Lookup results are typed so a missing key cannot crash later.
If you know Python, this is an intentional difference: dict["missing"] returns None in Sifr instead of raising KeyError.
When you need module-level helpers such as Counter or deque, use Collections.

Tuples

Tuples group a fixed shape of values.
Use a tuple when the position of each value has meaning and the shape is known.

Sets

Sifr’s set helpers live in sifr.collections and return deduplicated list values. This keeps ownership straightforward while still giving you set operations.

Truthiness

Collections can be checked directly for emptiness.
Truthiness is a convenience for branching. It does not replace typed None handling when a value is optional.

Next Steps

Iteration

Learn loops, comprehensions, and safe iteration patterns.

Python Developer Guide

See why missing dictionary keys return None instead of raising KeyError.

Collections

Use Counter, deque, and set helpers from sifr.collections.