Pyli/Methods/Typing
Typing
Although Pyli is strongly typed (meaning, everything has a type that can't change), specifying what types are expected is possible.
- (expect it template):
- If template is a list, then it must match, recursively, the template.
- If template is a dict, then it must match, recursively, the template.
- If template is a type, then the type should match.
- It template is a function, then it specifies a special matching function.
- (cast it target-type): This will try to force the type to the target type. This is really a generic method that should be expanded as needed.