Numeric Types
int
Integer type. By default, integers are 32-bit signed integers on most architectures. Size Configuration:- Default: 32-bit signed integer (on most architectures)
- Use
--int64flag for 64-bit integers - Use
--int32flag to explicitly specify 32-bit - Use
--int128flag for 128-bit integers
- No arbitrary-precision arithmetic (unlike CPython)
- Integer overflow behavior follows C++ semantics
- Use appropriate size flag for your data range needs
float
Floating-point number type. Size Configuration:- Default: 64-bit double precision
- Use
--float32flag for 32-bit single precision - Use
--float64flag to explicitly specify 64-bit
bool
Boolean type with valuesTrue and False.
Supported Operations:
complex
Complex number type. Supported Operations:Sequence Types
str
String type for text data. Character Encoding:- Currently restricted to 1-byte characters
- No full Unicode/UTF-8 support
- ASCII and Latin-1 work fine
bytes
Immutable sequence of bytes. Supported Operations:bytearray
Mutable sequence of bytes. Supported Operations:list
Mutable sequence type. Type Restriction: All elements must be of the same type (or compatible types with common base). Supported Operations:tuple
Immutable sequence type. Type Restriction:- All elements same type for tuples of any length
- Mixed types allowed for length-2 tuples only
Mapping Type
dict
Dictionary mapping type. Type Restriction: Keys must be of one type, values must be of one type. Keys must be hashable. Supported Operations:Set Types
set
Unordered collection of unique elements. Type Restriction: All elements must be of the same type and hashable. Supported Operations:frozenset
Immutable set type. Supports same operations as set except modifications.Type Checking and Conversion
None Type
None represents absence of a value.
Important Restriction: None can only be mixed with non-scalar types (not with int, float, bool, or complex).
Performance Notes
- List operations: Appending is O(1) amortized. Prefer
append()over+in loops. - String concatenation: Use
"".join(list)for concatenating many strings instead of+in a loop. - Dictionary/set operations: Hash-based, typically O(1) for lookup/insert.
- Integer size: Smaller integer sizes can improve performance and memory usage if your values fit.
- Float size: 32-bit floats use less memory but have less precision.
See Also
- Supported Modules - Standard library module reference
- Limitations - Type system limitations and restrictions