+ <section class="journey-section"><div><h2>Start with functions as named behavior.</h2><p class="meta">Functions are the first abstraction boundary because they name behavior and control how callers provide information.</p><ul class="journey-list"><li><a class="text-link journey-item-title" href="/examples/functions">Functions</a><p class="meta">package behavior behind a name</p></li><li><a class="text-link journey-item-title" href="/examples/keyword-only-arguments">Keyword-only Arguments</a><p class="meta">make important call-site choices explicit</p></li><li><a class="text-link journey-item-title" href="/examples/positional-only-parameters">Positional-only Parameters</a><p class="meta">hide parameter names that should remain implementation details</p></li><li><a class="text-link journey-item-title" href="/examples/args-and-kwargs">Args and Kwargs</a><p class="meta">accept flexible call shapes when forwarding or adapting APIs</p></li><li><a class="text-link journey-item-title" href="/examples/multiple-return-values">Multiple Return Values</a><p class="meta">return multiple related values as a tuple</p></li></ul></div><figure class="journey-figure"><svg viewBox="0 0 188 80" xmlns="http://www.w3.org/2000/svg"><line x1="0" y1="44" x2="25.0" y2="44.0" stroke="#521000" stroke-width="1.0"/><polygon points="32,44 25.0,46.8 25.0,41.2" fill="#521000"/><text x="16" y="36" font-family="-apple-system, 'Source Sans Pro', sans-serif" font-size="9" fill="rgba(82, 16, 0, 0.7)" text-anchor="middle">args</text><rect x="34" y="26" width="110" height="36" fill="none" stroke="#521000" stroke-width="1.0"/><text x="40" y="23" font-family="-apple-system, 'Source Sans Pro', sans-serif" font-size="8" fill="rgba(82, 16, 0, 0.7)" text-anchor="start" letter-spacing="0.5">DEF F(...)</text><line x1="144" y1="44" x2="169.0" y2="44.0" stroke="#521000" stroke-width="1.0"/><polygon points="176,44 169.0,46.8 169.0,41.2" fill="#521000"/><text x="160" y="36" font-family="-apple-system, 'Source Sans Pro', sans-serif" font-size="9" fill="rgba(82, 16, 0, 0.7)" text-anchor="middle">return</text></svg><figcaption>A function is the first abstraction boundary: arguments in, body, return value out.</figcaption></figure></section><section class="journey-section"><div><h2>Use functions as values.</h2><p class="meta">Python functions can capture state, be passed around, and wrap other functions.</p><ul class="journey-list"><li><a class="text-link journey-item-title" href="/examples/closures">Closures</a><p class="meta">capture state in nested functions</p></li><li><a class="text-link journey-item-title" href="/examples/scope-global-nonlocal">Global and Nonlocal</a><p class="meta">control where assignment happens</p></li><li><a class="text-link journey-item-title" href="/examples/recursion">Recursion</a><p class="meta">solve self-similar problems with a base case</p></li><li><a class="text-link journey-item-title" href="/examples/lambdas">Lambdas</a><p class="meta">write small unnamed functions for expression positions</p></li><li><a class="text-link journey-item-title" href="/examples/decorators">Decorators</a><p class="meta">wrap behavior without changing call sites</p></li><li><p class="journey-gap-label">Gap · Partial functions</p><p class="meta">show how to pre-fill arguments with `functools.partial`</p></li></ul></div><figure class="journey-figure"><svg viewBox="0 0 200 92" xmlns="http://www.w3.org/2000/svg"><rect x="0" y="22" width="80" height="36" fill="none" stroke="#521000" stroke-width="1.0"/><text x="6" y="19" font-family="-apple-system, 'Source Sans Pro', sans-serif" font-size="8" fill="rgba(82, 16, 0, 0.7)" text-anchor="start" letter-spacing="0.5">FN</text><text x="40" y="44" font-family="'JetBrains Mono', 'IBM Plex Mono', Menlo, monospace" font-size="10" fill="#521000" text-anchor="middle">def f</text><line x1="80" y1="40" x2="109.0" y2="40.0" stroke="#FF4801" stroke-width="1.4"/><polygon points="116,40 109.0,42.8 109.0,37.2" fill="#FF4801"/><rect x="118" y="26" width="80" height="28" fill="rgba(82, 16, 0, 0.05)" stroke="#521000" stroke-width="1.0"/><text x="158.0" y="44.0" font-family="'JetBrains Mono', 'IBM Plex Mono', Menlo, monospace" font-size="10" fill="#521000" text-anchor="middle">g = fn</text><text x="105" y="76" font-family="-apple-system, 'Source Sans Pro', sans-serif" font-size="9" fill="rgba(82, 16, 0, 0.7)" text-anchor="middle">second name binds to the same function</text></svg><figcaption>Functions are first-class values. A second name binds to the same function object.</figcaption></figure></section><section class="journey-section"><div><h2>Bundle behavior with state.</h2><p class="meta">Classes become useful when data and behavior need to move together behind a stable interface.</p><ul class="journey-list"><li><a class="text-link journey-item-title" href="/examples/classes">Classes</a><p class="meta">bundle state and behavior into a new object type</p></li><li><a class="text-link journey-item-title" href="/examples/inheritance-and-super">Inheritance and Super</a><p class="meta">reuse and extend behavior through parent classes</p></li><li><a class="text-link journey-item-title" href="/examples/dataclasses">Dataclasses</a><p class="meta">generate common methods for data containers</p></li><li><a class="text-link journey-item-title" href="/examples/properties">Properties</a><p class="meta">keep attribute syntax while adding computation or validation</p></li><li><a class="text-link journey-item-title" href="/examples/special-methods">Special Methods</a><p class="meta">connect objects to Python syntax and built-ins</p></li><li><a class="text-link journey-item-title" href="/examples/metaclasses">Metaclasses</a><p class="meta">customize class creation when ordinary class tools are not enough</p></li><li><p class="journey-gap-label">Gap · Descriptors</p><p class="meta">explain the protocol behind methods, properties, and managed attributes</p></li></ul></div><figure class="journey-figure"><svg viewBox="0 0 152 108" xmlns="http://www.w3.org/2000/svg"><rect x="0" y="8" width="150" height="92" fill="none" stroke="#521000" stroke-width="1.0"/><text x="6" y="5" font-family="-apple-system, 'Source Sans Pro', sans-serif" font-size="8" fill="rgba(82, 16, 0, 0.7)" text-anchor="start" letter-spacing="0.5">CLASS BOX</text><text x="12" y="26" font-family="-apple-system, 'Source Sans Pro', sans-serif" font-size="8" fill="rgba(82, 16, 0, 0.7)" text-anchor="start" letter-spacing="0.5">STATE</text><rect x="12" y="32" width="126" height="22" fill="none" stroke="#521000" stroke-width="1.0"/><text x="75.0" y="47.0" font-family="'JetBrains Mono', 'IBM Plex Mono', Menlo, monospace" font-size="10" fill="#521000" text-anchor="middle">x · y</text><text x="12" y="64" font-family="-apple-system, 'Source Sans Pro', sans-serif" font-size="8" fill="rgba(82, 16, 0, 0.7)" text-anchor="start" letter-spacing="0.5">METHODS</text><rect x="12" y="70" width="126" height="22" fill="none" stroke="#521000" stroke-width="1.0"/><text x="75.0" y="85.0" font-family="'JetBrains Mono', 'IBM Plex Mono', Menlo, monospace" font-size="10" fill="#521000" text-anchor="middle">move(...)</text></svg><figcaption>Classes group fields and methods so data and behavior move together behind one interface.</figcaption></figure></section>
0 commit comments