Skip to content

Commit 3c8443b

Browse files
docs(classes): Allign docs and clean redaction.
1 parent 943de88 commit 3c8443b

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

docs/pages/language/classes.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ title: "Classes"
33
description: "User-defined classes as state machines and library namespaces."
44
---
55

6-
Edge Python is functional-first, classes are state containers and namespaces, not the primary abstraction. Two patterns: state machines (a few methods that mutate the receiver) and namespaces (a bundle of related functions and constants).
6+
Where classes are state containers and namespaces, not the primary abstraction (decided by design for the compiler purpose). Two patterns: state machines (a few methods that mutate the receiver) and namespaces (a bundle of related functions and constants).
77

8-
Single-level inheritance with `super()`, `@property` / `@x.setter`, full dunder protocol for operators, indexing, iteration, context managers (see [Dunder methods](/language/dunders)). Multi-base C3 MRO, descriptors, metaclasses, `__slots__` are out of scope.
8+
Single-level inheritance with `super()`, `@property` / `@x.setter`, and a curated dunder protocol covering operators, indexing, iteration, hashing, context managers, and attribute fallback (see [Dunder methods](/language/dunders)). Multi-base C3 MRO, descriptors, metaclasses, `__slots__` are out of scope.
99

1010
## State-machine pattern
1111

@@ -31,7 +31,7 @@ print(c.value())
3131

3232
## Namespace pattern
3333

34-
A class with no `__init__` and no per-instance state is a namespace. Methods called on the class are unbound, no `self` prepended.
34+
A class with no `__init__` and no per-instance state is a namespace. Methods called on the class are unbound no `self` prepended.
3535

3636
```python
3737
class Status:
@@ -61,7 +61,7 @@ print(Math.cube(3))
6161

6262
## Inheritance and super()
6363

64-
Single base via `class Sub(Base):`. Methods not on the subclass are looked up linearly on the base, no C3 MRO. `isinstance(x, Base)` walks the same chain, so `Sub` instances are also instances of every ancestor.
64+
Single base via `class Sub(Base):`. Methods not on the subclass are looked up linearly on the base no C3 MRO. `isinstance(x, Base)` walks the same chain, so `Sub` instances are also instances of every ancestor.
6565

6666
`super()` (zero-arg) delegates to the next class up the chain, bound to current `self`. Most common in `__init__` to extend a base constructor.
6767

@@ -102,7 +102,7 @@ True
102102

103103
## Class decorators
104104

105-
A class decorator wraps the class object the same way it wraps a function, the decorator is called with the class; its return binds to the name.
105+
A class decorator wraps the class object the same way it wraps a function the decorator is called with the class; its return binds to the name.
106106

107107
```python
108108
def tag(cls):
@@ -125,7 +125,7 @@ tagged
125125

126126
## Properties
127127

128-
`@property` turns a method into a read-only attribute. `@x.setter` (via `property.setter`) makes it writable. Properties live on the class, subclasses inherit and can override either side.
128+
`@property` turns a method into a read-only attribute. `@x.setter` (via `property.setter`) makes it writable. Properties live on the class; subclasses inherit and can override either side.
129129

130130
```python
131131
class Temp:
@@ -174,7 +174,7 @@ See [Dunder methods](/language/dunders) for the full matrix.
174174

175175
* Multi-base inheritance with proper C3 MRO. `class C(A, B):` parses and both bases are stored, but resolution is a linear depth-first walk, not C3. Prefer single inheritance.
176176
* Metaclasses, descriptors (`__get__` / `__set__`), `__slots__`, ABCs, `__init_subclass__`.
177-
* `@staticmethod` / `@classmethod`, use the namespace pattern or free functions.
178-
* Async dunders, see [Dunders, What's not dispatched](/language/dunders#whats-not-dispatched).
177+
* `@staticmethod` / `@classmethod` use the namespace pattern or free functions.
178+
* Async dunders; see [Dunders, What's not dispatched](/language/dunders#whats-not-dispatched).
179179

180-
Behaviour reuse via free functions and composition remains the default, fast dispatch, aligned with the functional-first identity. Reach for inheritance and operator overloading when the abstraction genuinely calls for them.
180+
Behaviour reuse via free functions and composition remains the default fast dispatch, aligned with the functional-first identity. Reach for inheritance and operator overloading when the abstraction genuinely calls for them.

0 commit comments

Comments
 (0)