Skip to content

Builtins

Builtin functions

  • abs, round, len — kept, each dispatched through the capability trait that already covers it (SupportsAbs[K], SupportsRound[K], Sized) rather than a single hardcoded signature — abs returns int for an int and float for a complex, the type-level consequence of dispatching on the argument's own type instead of calling one fixed method.
  • fields — walks a class's, trait's, or module's own members, dispatched on which it's given (an instance or the class itself included), replacing both Python's vars() (no __dict__ to return) and dir() (an ordered, documented walk instead of an unordered list of bare names).
  • asdict — flattens a record you already have, anonymous or a named class instance, into a plain dict[str, object] by walking fields(); not a way to originate one — the linter prefers {"x": 0} over asdict((x=0)) whenever nothing else uses the record itself.
  • zip — always strict. Mismatched-length iterables are a runtime error, never silent truncation to the shortest — the same class of mistake assert's required parentheses closes elsewhere, just for iteration instead of assertion. Python's own zip needs an explicit strict=True to opt into this; Lucid has no other mode.
  • any, all — kept as ordinary functions. any the function and any the keyword (Existential types) are distinguished the same way type/match/not already are elsewhere: by position. any(xs) is a call; any Trait is bare, no parentheses, and never appears where a call would.
  • iter, locals, format, hash, help, sum, reversed, repr, print, enumerate, map, max, min, sorted, slice, getattr, setattr, hasattr — kept, unchanged.
  • list, set, dict — construction takes exactly the one positional argument Python's own signature already allows — an iterable, or for dict, a mapping — never a second positional argument, and never a keyword argument. Python's dict() folds five different call shapes into one name — no arguments, a mapping, an iterable of pairs, keyword arguments, and combinations of a mapping or pairs with keyword arguments, each with its own rule for which value wins on a key collision. Lucid already has one way to build a collection from an unpacked source — a literal with */** spread, [*a] or {**kw} — so the constructor call never needs to be a second.
  • pow — kept, but multiple-dispatch, one case per base type, so the zero-base, negative-exponent case returns each type's own inf instead of raising, the same trade floor division and modulo already make.
  • super — kept, but takes no parentheses: super.save(), not super().save(). A class has at most one class parent, so calling through to the overridden implementation is never ambiguous the way it can be in Python's own cooperative multiple inheritance — there's nothing to call, only the one parent to name.

Removed builtins covers the rest of Python's builtins module: the names a specific design decision elsewhere in this spec actually removes or replaces.