Skip to content

Commit db35390

Browse files
ariasunisatwikkansal
authored andcommitted
Fix a syntax error and some spelling errors (satwikkansal#72)
1 parent ea5fc2f commit db35390

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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">An interesting collection of surprising snippets and lesser-known Python features.</p>
44

55
[![WTFPL 2.0][license-image]][license-url]
66

@@ -77,7 +77,7 @@ So, here we go...
7777
- [▶ Yes, it exists!](#-yes-it-exists)
7878
- [▶ Inpinity *](#-inpinity-)
7979
- [▶ Mangling time! *](#-mangling-time-)
80-
- [Section: Miscallaneous](#section-miscallaneous)
80+
- [Section: Miscellaneous](#section-miscellaneous)
8181
- [`+=` is faster](#--is-faster)
8282
- [▶ Let's make a giant string!](#-lets-make-a-giant-string)
8383
- [▶ Explicit typecast of strings](#-explicit-typecast-of-strings)
@@ -97,22 +97,22 @@ All the examples are structured like below:
9797

9898
> ### ▶ Some fancy Title *
9999
> The asterisk at the end of the title indicates the example was not present in the first release and has been recently added.
100-
>
100+
>
101101
> ```py
102102
> # Setting up the code.
103103
> # Preparation for the magic...
104104
> ```
105-
>
105+
>
106106
> **Output (Python version):**
107107
> ```py
108108
> >>> triggering_statement
109109
> Probably unexpected output
110110
> ```
111111
> (Optional): One line describing the unexpected output.
112-
>
113-
>
112+
>
113+
>
114114
> #### 💡 Explanation:
115-
>
115+
>
116116
> * Brief explanation of what's happening and why is it happening.
117117
> ```py
118118
> Setting up examples for clarification (if necessary)
@@ -241,7 +241,7 @@ some_dict[5] = "Python"
241241
True
242242
```
243243
**Note:** Objects with different values may also have same hash (known as hash collision).
244-
* When the statement `some_dict[5] = "Python"` is executed, the existing value "JavaScript" is overwritten with "Python" because Python recongnizes `5` and `5.0` as the same keys of the dictionary `some_dict`.
244+
* When the statement `some_dict[5] = "Python"` is executed, the existing value "JavaScript" is overwritten with "Python" because Python recognizes `5` and `5.0` as the same keys of the dictionary `some_dict`.
245245
* This StackOverflow [answer](https://stackoverflow.com/a/32211042/4354153) explains beautifully the rationale behind it.
246246
247247
---
@@ -1135,7 +1135,7 @@ str
11351135
and type(other) is SomeClass
11361136
and super().__eq__(other)
11371137
)
1138-
1138+
11391139
# When we define a custom __eq__, Python stops automatically inheriting the
11401140
# __hash__ method, so we need to define it as well
11411141
__hash__ = str.__hash__
@@ -1313,7 +1313,7 @@ Shouldn't that be 100?
13131313
> First, tabs are replaced (from left to right) by one to eight spaces such that the total number of characters up to and including the replacement is a multiple of eight <...>
13141314
* So the "tab" at the last line of `square` function is replaced with eight spaces, and it gets into the loop.
13151315
* Python 3 is kind enough to throw an error for such cases automatically.
1316-
1316+
13171317
**Output (Python 3.x):**
13181318
```py
13191319
TabError: inconsistent use of tabs and spaces in indentation
@@ -1697,7 +1697,7 @@ a += [5, 6, 7, 8]
16971697
16981698
* The expression `a = a + [5,6,7,8]` generates a new list and sets `a`'s reference to that new list, leaving `b` unchanged.
16991699
1700-
* The expression `a + =[5,6,7,8]` is actually mapped to an "extend" function that operates on the list such that `a` and `b` still point to the same list that has been modified in-place.
1700+
* The expression `a += [5,6,7,8]` is actually mapped to an "extend" function that operates on the list such that `a` and `b` still point to the same list that has been modified in-place.
17011701
17021702
---
17031703
@@ -1731,7 +1731,7 @@ UnboundLocalError: local variable 'a' referenced before assignment
17311731
a += 1
17321732
return a
17331733
```
1734-
1734+
17351735
**Output:**
17361736
```py
17371737
>>> another_func()
@@ -2127,7 +2127,7 @@ Why did `Yo()._Yo__honey` worked? Only Indian readers would understand.
21272127
21282128
---
21292129
2130-
## Section: Miscallaneous
2130+
## Section: Miscellaneous
21312131
21322132
21332133
### ▶ `+=` is faster
@@ -2272,7 +2272,7 @@ nan
22722272
### ▶ Minor Ones
22732273
22742274
* `join()` is a string operation instead of list operation. (sort of counter-intuitive at first usage)
2275-
2275+
22762276
**💡 Explanation:**
22772277
If `join()` is a method on a string then it can operate on any iterable (list, tuple, iterators). If it were a method on a list, it'd have to be implemented separately by every type. Also, it doesn't make much sense to put a string-specific method on a generic `list` object API.
22782278
@@ -2369,8 +2369,8 @@ If you have any wtfs, ideas or suggestions, please share.
23692369
23702370
You can use these quick links for Twitter and Linkedin.
23712371
2372-
[Twitter](https://twitter.com/intent/tweet?url=https://github.com/satwikkansal/wtfpython&hastags=python,wtfpython) |
2373-
[Linkedin](https://www.linkedin.com/shareArticle?url=https://github.com/satwikkansal&title=What%20the%20f*ck%20Python!&summary=An%20interesting%20collection%20of%20subtle%20and%20tricky%20Python%20snippets.)
2372+
[Twitter](https://twitter.com/intent/tweet?url=https://github.com/satwikkansal/wtfpython&hastags=python,wtfpython)
2373+
| [Linkedin](https://www.linkedin.com/shareArticle?url=https://github.com/satwikkansal&title=What%20the%20f*ck%20Python!&summary=An%20interesting%20collection%20of%20subtle%20and%20tricky%20Python%20snippets.)
23742374
23752375
## Need a pdf version?
23762376

0 commit comments

Comments
 (0)