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: README.md
+21-6Lines changed: 21 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -3377,9 +3377,9 @@ Let's increase the number of iterations by a factor of 10.
3377
3377
True
3378
3378
>>> False ** True == False
3379
3379
True
3380
-
>>> True ** False == True
3380
+
>>> True ** False == True
3381
3381
True
3382
-
>>> True ** True == True
3382
+
>>> True ** True == True
3383
3383
True
3384
3384
```
3385
3385
@@ -3395,6 +3395,13 @@ Let's increase the number of iterations by a factor of 10.
3395
3395
3396
3396
**💡 Explanation:** The `@` operator was added in Python 3.5 keeping scientific community in mind. Any object can overload `__matmul__` magic method to define behavior for this operator.
3397
3397
3398
+
* From Python 3.8 onwards you can use a typical f-string syntax like `f'{some_var=}` for quick debugging. Example,
3399
+
```py
3400
+
>>> some_string = "wtfpython"
3401
+
>>> f'{some_string=}'
3402
+
"string='wtfpython'"
3403
+
```
3404
+
3398
3405
* Python uses 2 bytes for local variable storage in functions. In theory, this means that only 65536 variables can be defined in a function. However, python has a handy solution built in that can be used to store more than 2^16 variable names. The following code demonstrates what happens in the stack when more than 65536 local variables are defined (Warning: This code prints around 2^18 lines of text, so be prepared!):
3399
3406
3400
3407
```py
@@ -3454,17 +3461,25 @@ f()
3454
3461
The behavior is due to the matching of empty substring(`''`) with slices of length 0 in the original string.
3455
3462
3456
3463
---
3457
-
3458
-
<p align="center">~~~ That's all folks! ~~~</p>
3459
3464
---
3460
3465
3461
3466
# Contributing
3462
3467
3463
-
All patches are welcome! Please see [CONTRIBUTING.md](/CONTRIBUTING.md) for further details. For discussions, you can either create a new [issue](https://github.com/satwikkansal/wtfpython/issues/new) or ping on the Gitter [channel](https://gitter.im/wtfpython/Lobby)
3468
+
Here are a few ways that you can contribute to wtfpython,
3469
+
3470
+
- Suggesting new examples
3471
+
- Helping with translation (See issues labeled translation)
3472
+
- Minor corrections like pointing out outdated snippets, typos, formatting errors, etc
- Suggestions in general for making this project more fun and useful
3475
+
3476
+
Please see [CONTRIBUTING.md](/CONTRIBUTING.md) for more details. Feel free to create a new [issue](https://github.com/satwikkansal/wtfpython/issues/new).
3477
+
3478
+
PS: Please don't reach out with backlinking requests, no links will be added unless they're highly relevant to the project.
3464
3479
3465
3480
# Acknowledgements
3466
3481
3467
-
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.
3482
+
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.
0 commit comments