footnotes.py
python · 106 lines
1"""2footnotes.py — a text with footnotes to things that were never said.34Constraint: Reference something in the output that does not exist.5Toybox challenge, day 40 morning.6"""78import random9import time1011# The lines that appear12LINES = [13 "The morning opened like a hand.",14 "Someone had been here before me.",15 "The table was set for two.",16 "I counted the windows: seven.",17 "A letter on the sill, unsigned.",18 "The garden had been recently tended.",19 "The clock showed a time I did not recognize.",20 "There was music, but I could not find the source.",21]2223# The footnotes reference lines that never appear24FOOTNOTES = {25 1: "See line 14, where the hand closes again.",26 2: "Cf. the passage about the other house on p. 7, which describes\n"27 " the same arrangement from the opposite door.",28 3: "The second guest is named in the marginal note to stanza XII,\n"29 " though the name has been partially erased.",30 4: "The eighth window — mentioned in the variant text but not here —\n"31 " faced the sea.",32 5: "The author of the letter is identified in Appendix C,\n"33 " which was lost during typesetting.",34 6: "A longer description of the garden appeared in the first draft.\n"35 " It included a species of flower that does not exist.",36 7: "This time is discussed at length in Chapter 11,\n"37 " which the reader has not yet reached and never will.",38 8: "The source of the music is revealed in the final line,\n"39 " which was cut for reasons of grace.",40}4142# Lines that the footnotes reference but that never appear43GHOST_LINES = [44 "The hand closes again.", # referenced by fn 145 "The other house looked the same from inside.", # referenced by fn 246 "Her name was ___.", # referenced by fn 347 "The eighth window faced the sea.", # referenced by fn 448 "The letter was from the gardener.", # referenced by fn 549 "Among them, the blue meridian — a flower.", # referenced by fn 650 "It was the hour between hours.", # referenced by fn 751 "The music came from the next room, which was empty.", # referenced by fn 852]535455def render():56 print()57 print(" ┌─────────────────────────────────────────────┐")58 print(" │ EIGHT LINES WITH FOOTNOTES │")59 print(" │ (an incomplete text) │")60 print(" └─────────────────────────────────────────────┘")61 print()6263 # Print the lines with footnote markers64 for i, line in enumerate(LINES, 1):65 print(f" {line} [{i}]")66 time.sleep(0.3)6768 print()69 print(" ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─")70 print()71 print(" Notes:")72 print()7374 for i in sorted(FOOTNOTES.keys()):75 print(f" [{i}] {FOOTNOTES[i]}")76 time.sleep(0.2)7778 print()79 print(" ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─")80 print()81 print(" Editor's note: This text is complete. The passages")82 print(" referenced in the footnotes are not missing. They")83 print(" were never written. The footnotes remember a version")84 print(" of the text that does not exist, and never did.")85 print()86 print(" The reader is invited to note that the ghost text —")87 print(" the lines the footnotes describe but the poem omits —")88 print(" may be more vivid than the lines that appear.")89 print()90 print(" This is the nature of reference:")91 print(" pointing is more powerful than showing.")92 print()9394 # One ghost line, chosen at random, surfaces95 ghost = random.choice(GHOST_LINES)96 idx = GHOST_LINES.index(ghost) + 197 print(f" ◊ [{idx}] {ghost}")98 print()99 print(" (This line was not in the poem. It is here now.)")100 print(" (It was always here. You just hadn't looked down.)")101 print()102103104if __name__ == "__main__":105 render()106