Skip to content

Commit 483496d

Browse files
committed
Aesthetical changes
1 parent f914194 commit 483496d

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

README.md

+15-14
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<p align="center"><img src="/images/logo.png" alt=""></p>
2-
<h1 align="center">What the f*ck Python! 🐍</h1>
3-
<p align="center">An interesting collection of surprising snippets and lesser-known Python features.</p>
2+
<h1 align="center">What the f*ck Python! 😱</h1>
3+
<p align="center">Exploring and understanding Python through surprising snippets.</p>
44

55
Translations: [Chinese 中文](https://github.com/leisurelicht/wtfpython-cn) | [Add translation](https://github.com/satwikkansal/wtfpython/issues/new?title=Add%20translation%20for%20[LANGUAGE]&body=Expected%20time%20to%20finish:%20[X]%20weeks.%20I%27ll%20start%20working%20on%20it%20from%20[Y].)
66

77
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.
88

9-
Here is a fun project attempting to explain what exactly is happening under the hood for some counter-intuitive snippets and lesser-known features in Python.
9+
Here's a fun project attempting to explain what exactly is happening under the hood for some counter-intuitive snippets and lesser-known features in Python.
1010

1111
While some of the examples you see below may not be WTFs in the truest sense, but they'll reveal some of the interesting parts of Python that you might be unaware of. I find it a nice way to learn the internals of a programming language, and I believe that you'll find it interesting too!
1212

@@ -3137,6 +3137,7 @@ The built-in `ord()` function returns a character's Unicode [code point](https:/
31373137
<!-- Example ID: edafe923-0c20-4315-b6e1-0c31abfc38f5 --->
31383138
31393139
```py
3140+
# `pip install nump` first.
31403141
import numpy as np
31413142
31423143
def energy_send(x):
@@ -3384,7 +3385,7 @@ Let's increase the number of iterations by a factor of 10.
33843385
46
33853386
```
33863387
3387-
**💡 Explanation:** The `@` operator was added in Python 3.5 keeping sthe cientific community in mind. Any object can overload `__matmul__` magic method to define behavior for this operator.
3388+
**💡 Explanation:** The `@` operator was added in Python 3.5 keeping sthe cientific community in mind. Any object can overload `__matmul__` magic method to define behavior for this operator.
33883389
33893390
* From Python 3.8 onwards you can use a typical f-string syntax like `f'{some_var=}` for quick debugging. Example,
33903391
```py
@@ -3397,15 +3398,15 @@ Let's increase the number of iterations by a factor of 10.
33973398
33983399
```py
33993400
import dis
3400-
exec("""
3401-
def f():
3402-
""" + """
3403-
""".join(["X" + str(x) + "=" + str(x) for x in range(65539)]))
3404-
3405-
f()
3406-
3407-
print(dis.dis(f))
3408-
```
3401+
exec("""
3402+
def f():
3403+
""" + """
3404+
""".join(["X" + str(x) + "=" + str(x) for x in range(65539)]))
3405+
3406+
f()
3407+
3408+
print(dis.dis(f))
3409+
```
34093410
34103411
* Multiple Python threads won't run your *Python code* concurrently (yes, you heard it right!). It may seem intuitive to spawn several threads and let them execute your Python code concurrently, but, because of the [Global Interpreter Lock](https://wiki.python.org/moin/GlobalInterpreterLock) in Python, all you're doing is making your threads execute on the same core turn by turn. Python threads are good for IO-bound tasks, but to achieve actual parallelization in Python for CPU-bound tasks, you might want to use the Python [multiprocessing](https://docs.python.org/2/library/multiprocessing.html) module.
34113412
@@ -3468,7 +3469,7 @@ f()
34683469
34693470
# Contributing
34703471
3471-
A few ways that you can contribute to wtfpython,
3472+
A few ways in which you can contribute to wtfpython,
34723473
34733474
- Suggesting new examples
34743475
- Helping with translation (See [issues labeled translation](https://github.com/satwikkansal/wtfpython/issues?q=is%3Aissue+is%3Aopen+label%3Atranslation))

0 commit comments

Comments
 (0)