You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/newsletters/2023/WEEK_28.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -380,7 +380,7 @@ To dive deeper into the `string` module and its functionalities, here are some r
380
380
- Official Python Documentation: [`string`](https://docs.python.org/3/library/string.html)
381
381
382
382
383
-
### 🔢 Python Match Statement
383
+
### 6. 🔢 Python Match Statement
384
384
385
385
Introduced in Python 3.10, the match statement is a powerful tool for pattern matching. It allows you to simplify complex if-elif-else chains by providing a concise and readable syntax. Here's an example:
The match statement evaluates the input expression (`day_number` in this case) and compares it against different patterns (`case` statements). If a match is found, the corresponding block of code is executed. The `_` represents a wildcard pattern that matches anything.
409
409
410
-
### 🌪️ Decorators that Take Arguments
410
+
### 7. 🌪️ Decorators that Take Arguments
411
411
412
412
Building upon the [previous article](https://python-world.github.io/newsletter/newsletters/2023/WEEK_27.html#unleash-the-power-of-python-function-decorators) on decorators, we can enhance their functionality by allowing them to accept arguments. This provides greater flexibility and customization.
413
413
@@ -432,7 +432,7 @@ greet("John")
432
432
433
433
In this example, the `repeat` decorator takes an argument `n` and returns a decorator function. This decorator function, in turn, takes the original function as an argument and returns the modified function (`wrapper`). The modified function is then executed multiple times, as specified by the `repeat` argument.
434
434
435
-
### 🛫 Map and Filter Functions
435
+
### 8. 🛫 Map and Filter Functions
436
436
437
437
Python provides two built-in functions, `map` and `filter`, that are widely used to process iterables.
In Python, the `global` and `nonlocal` keywords allow you to modify variables outside the current scope.
460
460
@@ -487,7 +487,7 @@ def outer():
487
487
outer() # Output: 2
488
488
```
489
489
490
-
### 🫙 Closures
490
+
### 10. 🫙 Closures
491
491
492
492
A closure is a function object that remembers values in its enclosing scope, even if they are not present in memory. This allows the function to access and manipulate variables from the outer function, even after the outer function has finished executing. Here's an example:
0 commit comments