On this page
Existence unique per conduit๏
๐ข Beginner ยท Lesson 15
unique_per_conduit - each conduit scope holds its OWN single instance; stable inside the scope, separate across scopes.
Before you run๏
Use the Beginner 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/01_beginner/15_existence_unique_per_conduit.py
py -3.14t UX_and_AIX_experiences/01_beginner/15_existence_unique_per_conduit.py
Public surface๏
md.Existence.unique_per_conduit
Code๏
1"""
2TIER: beginner (15)
3GOAL: unique_per_conduit - each conduit scope holds its OWN single instance;
4 stable inside the scope, separate across scopes.
5SURFACE EXERCISED: md.Existence.unique_per_conduit
6"""
7import melder as md
8
9
10class ScopeLocalSession:
11 pass
12
13
14def main() -> None:
15 book = md.Spellbook()
16 book.bind(spell=ScopeLocalSession, existence="unique_per_conduit")
17 root = book.conjure()
18 child_a = root.create_lesser_conduit()
19 child_b = root.create_lesser_conduit()
20
21 a1, a2 = child_a.meld(spell=ScopeLocalSession), child_a.meld(spell=ScopeLocalSession)
22 b1 = child_b.meld(spell=ScopeLocalSession)
23 r1 = root.meld(spell=ScopeLocalSession)
24 assert a1 is a2
25 assert len({id(a1), id(b1), id(r1)}) == 3
26 print("unique_per_conduit: stable within a scope, three scopes = three instances")
27
28
29if __name__ == "__main__":
30 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.