On this page

The basic rhythm๏ƒ

๐ŸŸข Beginner ยท Lesson 21

The rhythm of every melder program: bind everything FIRST, conjure ONCE, meld everywhere after. Three verbs, one order.

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/21_the_basic_rhythm.py
py -3.14t UX_and_AIX_experiences/01_beginner/21_the_basic_rhythm.py

Download this collection ยท Source on GitHub

Public surface๏ƒ

the bind -> conjure -> meld order

Code๏ƒ

 1"""
 2TIER: beginner (21)
 3GOAL: The rhythm of every melder program: bind everything FIRST,
 4      conjure ONCE, meld everywhere after. Three verbs, one order.
 5SURFACE EXERCISED: the bind -> conjure -> meld order
 6"""
 7import melder as md
 8
 9
10class Config:
11    pass
12
13
14class Database:
15    pass
16
17
18class Server:
19    pass
20
21
22def main() -> None:
23    book = md.Spellbook()
24
25    # 1. bind everything
26    book.bind(spell=Config, existence="unique")
27    book.bind(spell=Database, existence="unique")
28    book.bind(spell=Server, existence="many")
29
30    # 2. conjure once
31    conduit = book.conjure()
32
33    # 3. meld everywhere, as often as you like
34    for _ in range(3):
35        server = conduit.meld(spell=Server)
36        assert isinstance(server, Server)
37    assert conduit.meld(spell=Config) is conduit.meld(spell=Config)
38    print("bind everything, conjure once, meld everywhere")
39
40
41if __name__ == "__main__":
42    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 beginner examples ยท Level guide