On this page

Existence unique per conduit lineage๏ƒ

๐ŸŸก Intermediate ยท Lesson 05

unique_per_conduit_lineage - one instance per FAMILY: the root and every lesser descendant share the same object. A second family would need its own book (one book conjures ONE root - beginner law), so the lineage boundary IS the book boundary.

Before you run๏ƒ

Use the Intermediate guide for prerequisite concepts. Run from a checkout with Melder installed and Python 3.14 free-threading selected. The collection download includes the level's local helper modules.

Run the saved script๏ƒ

python UX_and_AIX_experiences/02_intermediate/05_existence_unique_per_conduit_lineage.py
py -3.14t UX_and_AIX_experiences/02_intermediate/05_existence_unique_per_conduit_lineage.py

Download this collection ยท Source on GitHub

Public surface๏ƒ

md.Existence.unique_per_conduit_lineage, create_lesser_conduit

Code๏ƒ

 1"""
 2TIER: intermediate (05)
 3GOAL: unique_per_conduit_lineage - one instance per FAMILY: the root and
 4      every lesser descendant share the same object. A second family
 5      would need its own book (one book conjures ONE root - beginner
 6      law), so the lineage boundary IS the book boundary.
 7SURFACE EXERCISED: md.Existence.unique_per_conduit_lineage,
 8                   create_lesser_conduit
 9"""
10import melder as md
11
12
13class FamilyLedger:
14    pass
15
16
17def main() -> None:
18    book = md.Spellbook()
19    book.bind(
20        spell=FamilyLedger,
21        existence=md.Existence.unique_per_conduit_lineage,
22    )
23    # ONE conjure per book; the family GROWS from the root instead.
24    root = book.conjure()
25    child = root.create_lesser_conduit()
26    grandchild = child.create_lesser_conduit()
27
28    ledgers = [root.meld("FamilyLedger"),
29               child.meld("FamilyLedger"),
30               grandchild.meld("FamilyLedger")]
31    assert ledgers[0] is ledgers[1] is ledgers[2]
32    print("three generations, one ledger:", type(ledgers[0]).__name__)
33    print("a sibling family = a second book with its own root (one "
34          "book, one conduit)")
35
36
37if __name__ == "__main__":
38    main()

Check the outcome๏ƒ

The script contains its own assertions or demonstrated refusal paths. Run it to evaluate those checks against your installed version. The code above is taken directly from the saved file; no run output is invented here.

More intermediate examples ยท Level guide

API contracts๏ƒ