1
0
mirror of https://github.com/satwikkansal/wtfpython synced 2024-11-22 11:04:25 +01:00

Fix indenting, add a minor example, and update contributing message

This commit is contained in:
Satwik 2019-11-04 23:18:52 +05:30
parent e18e56eba3
commit 888c9e1261

21
README.md vendored
View File

@ -3395,6 +3395,13 @@ Let's increase the number of iterations by a factor of 10.
**💡 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. **💡 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.
* From Python 3.8 onwards you can use a typical f-string syntax like `f'{some_var=}` for quick debugging. Example,
```py
>>> some_string = "wtfpython"
>>> f'{some_string=}'
"string='wtfpython'"
```
* 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!): * 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!):
```py ```py
@ -3454,13 +3461,21 @@ f()
The behavior is due to the matching of empty substring(`''`) with slices of length 0 in the original string. The behavior is due to the matching of empty substring(`''`) with slices of length 0 in the original string.
--- ---
<p align="center">~~~ That's all folks! ~~~</p>
--- ---
# Contributing # Contributing
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) Here are a few ways that you can contribute to wtfpython,
- Suggesting new examples
- Helping with translation (See issues labeled translation)
- Minor corrections like pointing out outdated snippets, typos, formatting errors, etc
- Identifying gaps (things inadequate explanation, redundancy, etc)
- Suggestions in general for making this project more fun and useful
Please see [CONTRIBUTING.md](/CONTRIBUTING.md) for more details. Feel free to create a new [issue](https://github.com/satwikkansal/wtfpython/issues/new).
PS: Please don't reach out with backlinking requests, no links will be added unless they're highly relevant to the project.
# Acknowledgements # Acknowledgements