1
0
mirror of https://github.com/satwikkansal/wtfpython synced 2024-05-30 09:58:05 +02:00

Fix a syntax error and some spelling errors (#72)

This commit is contained in:
Mélanie Chauvel 2018-02-28 21:37:48 +01:00 committed by Satwik Kansal
parent ea5fc2f47f
commit db35390786

16
README.md vendored
View File

@ -1,6 +1,6 @@
<p align="center"><img src="/images/logo.png" alt=""></p>
<h1 align="center"> What the f*ck Python! 🐍 </h1>
<p align="center"> An interesting collection of surprising snippets and lesser-known Python features.</p>
<h1 align="center">What the f*ck Python! 🐍</h1>
<p align="center">An interesting collection of surprising snippets and lesser-known Python features.</p>
[![WTFPL 2.0][license-image]][license-url]
@ -77,7 +77,7 @@ So, here we go...
- [ Yes, it exists!](#-yes-it-exists)
- [ Inpinity *](#-inpinity-)
- [ Mangling time! *](#-mangling-time-)
- [Section: Miscallaneous](#section-miscallaneous)
- [Section: Miscellaneous](#section-miscellaneous)
- [ `+=` is faster](#--is-faster)
- [ Let's make a giant string!](#-lets-make-a-giant-string)
- [ Explicit typecast of strings](#-explicit-typecast-of-strings)
@ -241,7 +241,7 @@ some_dict[5] = "Python"
True
```
**Note:** Objects with different values may also have same hash (known as hash collision).
* 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`.
* 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`.
* This StackOverflow [answer](https://stackoverflow.com/a/32211042/4354153) explains beautifully the rationale behind it.
---
@ -1697,7 +1697,7 @@ a += [5, 6, 7, 8]
* The expression `a = a + [5,6,7,8]` generates a new list and sets `a`'s reference to that new list, leaving `b` unchanged.
* 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.
* 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.
---
@ -2127,7 +2127,7 @@ Why did `Yo()._Yo__honey` worked? Only Indian readers would understand.
---
## Section: Miscallaneous
## Section: Miscellaneous
### ▶ `+=` is faster
@ -2369,8 +2369,8 @@ If you have any wtfs, ideas or suggestions, please share.
You can use these quick links for Twitter and Linkedin.
[Twitter](https://twitter.com/intent/tweet?url=https://github.com/satwikkansal/wtfpython&hastags=python,wtfpython) |
[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.)
[Twitter](https://twitter.com/intent/tweet?url=https://github.com/satwikkansal/wtfpython&hastags=python,wtfpython)
| [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.)
## Need a pdf version?