Skip to content

Commit f57c3ad

Browse files
authored
Merge pull request #11 from radon-project/feature/update-latest-docs
docs: add Magic Methods documentation and update navigation
2 parents a891135 + df98dcd commit f57c3ad

3 files changed

Lines changed: 489 additions & 0 deletions

File tree

docs/classes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ You may have noticed we declared a method called `__constructor__` in the above
7777
| Method Name | Operator | Example | Example if we used regular function calls instead of operators |
7878
|-------------|----------|---------|----------------------------------------------------------------|
7979
`__constructor__` | Class instantiation | `var foo = Foo(1, 2, 3)` | `var foo = create(Foo); foo.__constructor(1, 2, 3)`[^create_func] |
80+
`__destructor__` | Object deletion | `del foo` | `foo.__destructor__(); delete(foo)`[^delete_func] |
8081
`__add__` | Addition | `a + b` | `a.__add__(b)` |
8182
`__sub__` | Subtraction | `a - b` | `a.__sub__(b)` |
8283
`__mul__` | Multiplication | `a * b` | `a.__mul__(b)` |
@@ -92,5 +93,6 @@ You may have noticed we declared a method called `__constructor__` in the above
9293

9394

9495
[^create_func]: `create` doesn't actually exist. It's just pseudocode
96+
[^delete_func]: `delete` doesn't actually exist. It's just pseudocode showing the destructor is called before the variable is removed
9597
[^truthy_errors]: If `__truthy__` throws an error, it is ignored and treated as if it returned `false`
9698
[^truthy_recursion]: The `__truthy__` operator of the returned object will be called recursively until it is a `bool`

0 commit comments

Comments
 (0)