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
Python, being a beautifully designed high-level and interpreter-based programming language, provides us with many features for the programmer's comfort. But sometimes, the outcomes of a Python snippet may not seem obvious at first sight.
8
8
@@ -24,7 +24,7 @@ So, here we go...
24
24
-[Structure of the Examples](#structure-of-the-examples)
25
25
+[▶ Some fancy Title](#-some-fancy-title)
26
26
-[Usage](#usage)
27
-
-[👀 Examples](#%F0%9F%91%80-examples)
27
+
-[👀 Examples](#-examples)
28
28
*[Section: Strain your brain!](#section-strain-your-brain)
29
29
+[▶ First things first!](#-first-things-first)
30
30
+[▶ Strings can be tricky sometimes](#-strings-can-be-tricky-sometimes)
@@ -91,7 +91,6 @@ So, here we go...
91
91
+[▶ `+=` is faster](#--is-faster)
92
92
+[▶ Let's make a giant string!](#-lets-make-a-giant-string)
93
93
+[▶ Minor Ones](#-minor-ones)
94
-
*[~~~ That's all folks! ~~~](#-thats-all-folks-)
95
94
-[Contributing](#contributing)
96
95
-[Acknowledgements](#acknowledgements)
97
96
-[🎓 License](#%F0%9F%8E%93-license)
@@ -221,7 +220,7 @@ SyntaxError: invalid syntax
221
220
222
221
223
222
224
-
💡 Explanation
223
+
####💡 Explanation
225
224
226
225
**Quick walrus operator refresher**
227
226
@@ -3355,7 +3354,7 @@ Let's increase the number of iterations by a factor of 10.
3355
3354
+ `++a` parses as `+(+a)` which translates to `a`. Similarly, the output of the statement `--a` can be justified.
3356
3355
+ This StackOverflow [thread](https://stackoverflow.com/questions/3654830/why-are-there-no-and-operators-in-python) discusses the rationale behind the absence of increment and decrement operators in Python.
3357
3356
3358
-
* You must be aware of the Walrus operator in Python. But have you ever heard about _the space-invader operator_?
3357
+
* You must be aware of the Walrus operator in Python. But have you ever heard about *the space-invader operator*?
3359
3358
```py
3360
3359
>>> a = 42
3361
3360
>>> a -=- 1
@@ -3470,26 +3469,28 @@ f()
3470
3469
```
3471
3470
The behavior is due to the matching of empty substring(`''`) with slices of length 0 in the original string.
3472
3471
3472
+
**That's all folks!**
3473
+
3473
3474
---
3474
3475
---
3475
3476
3476
3477
# Contributing
3477
3478
3478
-
Here are a few ways that you can contribute to wtfpython,
3479
+
A few ways that you can contribute to wtfpython,
3479
3480
3480
3481
- Suggesting new examples
3481
-
- Helping with translation (See issues labeled translation)
3482
-
- Minor corrections like pointing out outdated snippets, typos, formatting errors, etc
- Suggestions in general for making this project more fun and useful
3482
+
- Helping with translation (See [issues labeled translation](https://github.com/satwikkansal/wtfpython/issues?q=is%3Aissue+is%3Aopen+label%3Atranslation))
3483
+
- Minor corrections like pointing out outdated snippets, typos, formatting errors, etc.
3484
+
- Identifying gaps (things like inadequate explanation, redundant examples, etc.)
3485
+
- Any creative suggestions to make this project more fun and useful
3485
3486
3486
-
Please see [CONTRIBUTING.md](/CONTRIBUTING.md) for more details. Feel free to create a new [issue](https://github.com/satwikkansal/wtfpython/issues/new).
3487
+
Please see [CONTRIBUTING.md](/CONTRIBUTING.md) for more details. Feel free to create a new [issue](https://github.com/satwikkansal/wtfpython/issues/new) to discuss things.
3487
3488
3488
3489
PS: Please don't reach out with backlinking requests, no links will be added unless they're highly relevant to the project.
3489
3490
3490
3491
# Acknowledgements
3491
3492
3492
-
The idea and design for this collection were initially inspired by Denys Dovhan's awesome project [wtfjs](https://github.com/denysdovhan/wtfjs). The overwhelming support by the community gave it the shape it is in right now.
3493
+
The idea and design for this collection were initially inspired by Denys Dovhan's awesome project [wtfjs](https://github.com/denysdovhan/wtfjs). The overwhelming support by pythonistas gave it the shape it is in right now.
3493
3494
3494
3495
#### Some nice Links!
3495
3496
* https://www.youtube.com/watch?v=sH4XF6pKKmk
@@ -3510,7 +3511,7 @@ The idea and design for this collection were initially inspired by Denys Dovhan'
0 commit comments