baml.Bool
A boolean value — either `true` or `false`.
Signature
class baml.BoolA boolean value — either true or false.
Source:<builtin>/baml/bool.bamlbytes 50–502
Static methods
Returns a random true or false, drawn from rng.
rng defaults to random.SystemRandom, the host's cryptographic
entropy source; pass a seeded generator to make the draw reproducible.
Each call consumes one byte of entropy and tests its high bit.
Implementations
baml.Concrete for T
Source:<builtin>/baml/core.bamlbytes 763–795
baml.ops.Compare for bool
Instance methods
clamp
(self, min: Self, max: Self) -> Self throws neverClamps self into the range [min, max].
Callers should pass min <= max; if min > max the result is always
min, because the lower clamp runs after the upper one. Written as the
min/max chain rather than a three-way match so it agrees with
int.clamp / float.clamp on that degenerate input too.
ge
(self, other: Self) -> bool throws neverWhether self orders after other or equals it. Defaults to
self.cmp(other) != Ordering.Less.
gt
(self, other: Self) -> bool throws neverWhether self orders strictly after other. Defaults to
self.cmp(other) == Ordering.Greater.
le
(self, other: Self) -> bool throws neverWhether self orders before other or equals it. Defaults to
self.cmp(other) != Ordering.Greater.
lt
(self, other: Self) -> bool throws neverWhether self orders strictly before other. Defaults to
self.cmp(other) == Ordering.Less.
max
(self, other: Self) -> Self throws neverTies return self, so max is stable when two values compare Equal
without being interchangeable.
min
(self, other: Self) -> Self throws neverTies return self, matching max.
Source:<builtin>/baml/ns_ops/comparison.bamlbytes 12076–12524
baml.ops.Equals for bool
Instance methods
eq
(self, other: bool) -> bool throws neverneq
(self, other: Self) -> bool throws neverWhether self and other differ. Defaults to !self.eq(other).
Override this only to compute the answer more directly; an override that
disagrees with !eq leaves the pair inconsistent. Equals for null
overrides it with a constant false, which is consistent because null
has exactly one value.
Source:<builtin>/baml/ns_ops/comparison.bamlbytes 11958–12074