22<h1 align =" center " >What the f*ck Python! 😱</h1 >
33<p align =" center " >Exploring and understanding Python through surprising snippets.</p >
44
5- Translations: [ Chinese 中文] ( https://github.com/robertparley/wtfpython-cn ) | [ Vietnamese Tiếng Việt] ( https://github.com/vuduclyunitn/wtfptyhon-vi ) | [ Spanish Español] ( https://web.archive.org/web/20220511161045/https://github.com/JoseDeFreitas/wtfpython-es ) | [ Korean 한국어] ( https://github.com/buttercrab/wtfpython-ko ) | [ Russian Русский] ( https://github.com/frontdevops /wtfpython ) | [ German Deutsch] ( https://github.com/BenSt099/wtfpython ) | [ 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]. )
5+ Translations: [ Chinese 中文] ( https://github.com/robertparley/wtfpython-cn ) | [ Vietnamese Tiếng Việt] ( https://github.com/vuduclyunitn/wtfptyhon-vi ) | [ Spanish Español] ( https://web.archive.org/web/20220511161045/https://github.com/JoseDeFreitas/wtfpython-es ) | [ Korean 한국어] ( https://github.com/buttercrab/wtfpython-ko ) | [ Russian Русский] ( https://github.com/satwikkansal /wtfpython/tree/master/translations/ru-russian ) | [ German Deutsch] ( https://github.com/BenSt099/wtfpython ) | [ 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
77Other modes: [ Interactive Website] ( https://wtfpython-interactive.vercel.app ) | [ Interactive Notebook] ( https://colab.research.google.com/github/satwikkansal/wtfpython/blob/master/irrelevant/wtf.ipynb ) | [ CLI] ( https://pypi.python.org/pypi/wtfpython )
88
@@ -24,84 +24,147 @@ So, here we go...
2424
2525<!-- toc -->
2626
27+ - [ Table of Contents] ( #table-of-contents )
2728- [ Structure of the Examples] ( #structure-of-the-examples )
28- + [ ▶ Some fancy Title] ( #-some-fancy-title )
2929- [ Usage] ( #usage )
3030- [ 👀 Examples] ( #-examples )
31- * [ Section: Strain your brain!] ( #section-strain-your-brain )
32- + [ ▶ First things first! * ] ( #-first-things-first- )
33- + [ ▶ Strings can be tricky sometimes] ( #-strings-can-be-tricky-sometimes )
34- + [ ▶ Be careful with chained operations] ( #-be-careful-with-chained-operations )
35- + [ ▶ How not to use ` is ` operator] ( #-how-not-to-use-is-operator )
36- + [ ▶ Hash brownies] ( #-hash-brownies )
37- + [ ▶ Deep down, we're all the same.] ( #-deep-down-were-all-the-same )
38- + [ ▶ Disorder within order * ] ( #-disorder-within-order- )
39- + [ ▶ Keep trying... * ] ( #-keep-trying- )
40- + [ ▶ For what?] ( #-for-what )
41- + [ ▶ Evaluation time discrepancy] ( #-evaluation-time-discrepancy )
42- + [ ▶ ` is not ... ` is not ` is (not ...) ` ] ( #-is-not--is-not-is-not- )
43- + [ ▶ A tic-tac-toe where X wins in the first attempt!] ( #-a-tic-tac-toe-where-x-wins-in-the-first-attempt )
44- + [ ▶ Schrödinger's variable] ( #-schrödingers-variable- )
45- + [ ▶ The chicken-egg problem * ] ( #-the-chicken-egg-problem- )
46- + [ ▶ Subclass relationships] ( #-subclass-relationships )
47- + [ ▶ Methods equality and identity] ( #-methods-equality-and-identity )
48- + [ ▶ All-true-ation * ] ( #-all-true-ation- )
49- + [ ▶ The surprising comma] ( #-the-surprising-comma )
50- + [ ▶ Strings and the backslashes] ( #-strings-and-the-backslashes )
51- + [ ▶ not knot!] ( #-not-knot )
52- + [ ▶ Half triple-quoted strings] ( #-half-triple-quoted-strings )
53- + [ ▶ What's wrong with booleans?] ( #-whats-wrong-with-booleans )
54- + [ ▶ Class attributes and instance attributes] ( #-class-attributes-and-instance-attributes )
55- + [ ▶ yielding None] ( #-yielding-none )
56- + [ ▶ Yielding from... return! * ] ( #-yielding-from-return- )
57- + [ ▶ Nan-reflexivity * ] ( #-nan-reflexivity- )
58- + [ ▶ Mutating the immutable!] ( #-mutating-the-immutable )
59- + [ ▶ The disappearing variable from outer scope] ( #-the-disappearing-variable-from-outer-scope )
60- + [ ▶ The mysterious key type conversion] ( #-the-mysterious-key-type-conversion )
61- + [ ▶ Let's see if you can guess this?] ( #-lets-see-if-you-can-guess-this )
62- + [ ▶ Exceeds the limit for integer string conversion] ( #-exceeds-the-limit-for-integer-string-conversion )
63- * [ Section: Slippery Slopes] ( #section-slippery-slopes )
64- + [ ▶ Modifying a dictionary while iterating over it] ( #-modifying-a-dictionary-while-iterating-over-it )
65- + [ ▶ Stubborn ` del ` operation] ( #-stubborn-del-operation )
66- + [ ▶ The out of scope variable] ( #-the-out-of-scope-variable )
67- + [ ▶ Deleting a list item while iterating] ( #-deleting-a-list-item-while-iterating )
68- + [ ▶ Lossy zip of iterators * ] ( #-lossy-zip-of-iterators- )
69- + [ ▶ Loop variables leaking out!] ( #-loop-variables-leaking-out )
70- + [ ▶ Beware of default mutable arguments!] ( #-beware-of-default-mutable-arguments )
71- + [ ▶ Catching the Exceptions] ( #-catching-the-exceptions )
72- + [ ▶ Same operands, different story!] ( #-same-operands-different-story )
73- + [ ▶ Name resolution ignoring class scope] ( #-name-resolution-ignoring-class-scope )
74- + [ ▶ Rounding like a banker * ] ( #-rounding-like-a-banker- )
75- + [ ▶ Needles in a Haystack * ] ( #-needles-in-a-haystack- )
76- + [ ▶ Splitsies * ] ( #-splitsies- )
77- + [ ▶ Wild imports * ] ( #-wild-imports- )
78- + [ ▶ All sorted? * ] ( #-all-sorted- )
79- + [ ▶ Midnight time doesn't exist?] ( #-midnight-time-doesnt-exist )
80- * [ Section: The Hidden treasures!] ( #section-the-hidden-treasures )
81- + [ ▶ Okay Python, Can you make me fly?] ( #-okay-python-can-you-make-me-fly )
82- + [ ▶ ` goto ` , but why?] ( #-goto-but-why )
83- + [ ▶ Brace yourself!] ( #-brace-yourself )
84- + [ ▶ Let's meet Friendly Language Uncle For Life] ( #-lets-meet-friendly-language-uncle-for-life )
85- + [ ▶ Even Python understands that love is complicated] ( #-even-python-understands-that-love-is-complicated )
86- + [ ▶ Yes, it exists!] ( #-yes-it-exists )
87- + [ ▶ Ellipsis * ] ( #-ellipsis- )
88- + [ ▶ Inpinity] ( #-inpinity )
89- + [ ▶ Let's mangle] ( #-lets-mangle )
90- * [ Section: Appearances are deceptive!] ( #section-appearances-are-deceptive )
91- + [ ▶ Skipping lines?] ( #-skipping-lines )
92- + [ ▶ Teleportation] ( #-teleportation )
93- + [ ▶ Well, something is fishy...] ( #-well-something-is-fishy )
94- * [ Section: Miscellaneous] ( #section-miscellaneous )
95- + [ ▶ ` += ` is faster] ( #--is-faster )
96- + [ ▶ Let's make a giant string!] ( #-lets-make-a-giant-string )
97- + [ ▶ Slowing down ` dict ` lookups * ] ( #-slowing-down-dict-lookups- )
98- + [ ▶ Bloating instance ` dict ` s * ] ( #-bloating-instance-dicts- )
99- + [ ▶ Minor Ones * ] ( #-minor-ones- )
31+ - [ Section: Strain your brain!] ( #section-strain-your-brain )
32+ - [ ▶ First things first! \* ] ( #-first-things-first- )
33+ - [ 💡 Explanation] ( #-explanation )
34+ - [ ▶ Strings can be tricky sometimes] ( #-strings-can-be-tricky-sometimes )
35+ - [ 💡 Explanation:] ( #-explanation-1 )
36+ - [ ▶ Be careful with chained operations] ( #-be-careful-with-chained-operations )
37+ - [ 💡 Explanation:] ( #-explanation-2 )
38+ - [ ▶ How not to use ` is ` operator] ( #-how-not-to-use-is-operator )
39+ - [ 💡 Explanation:] ( #-explanation-3 )
40+ - [ ▶ Hash brownies] ( #-hash-brownies )
41+ - [ 💡 Explanation] ( #-explanation-4 )
42+ - [ ▶ Deep down, we're all the same.] ( #-deep-down-were-all-the-same )
43+ - [ 💡 Explanation:] ( #-explanation-5 )
44+ - [ ▶ Disorder within order \* ] ( #-disorder-within-order- )
45+ - [ 💡 Explanation:] ( #-explanation-6 )
46+ - [ ▶ Keep trying... \* ] ( #-keep-trying- )
47+ - [ 💡 Explanation:] ( #-explanation-7 )
48+ - [ ▶ For what?] ( #-for-what )
49+ - [ 💡 Explanation:] ( #-explanation-8 )
50+ - [ ▶ Evaluation time discrepancy] ( #-evaluation-time-discrepancy )
51+ - [ 💡 Explanation] ( #-explanation-9 )
52+ - [ ▶ ` is not ... ` is not ` is (not ...) ` ] ( #-is-not--is-not-is-not- )
53+ - [ 💡 Explanation] ( #-explanation-10 )
54+ - [ ▶ A tic-tac-toe where X wins in the first attempt!] ( #-a-tic-tac-toe-where-x-wins-in-the-first-attempt )
55+ - [ 💡 Explanation:] ( #-explanation-11 )
56+ - [ ▶ Schrödinger's variable \* ] ( #-schrödingers-variable- )
57+ - [ 💡 Explanation:] ( #-explanation-12 )
58+ - [ ▶ The chicken-egg problem \* ] ( #-the-chicken-egg-problem- )
59+ - [ 💡 Explanation] ( #-explanation-13 )
60+ - [ ▶ Subclass relationships] ( #-subclass-relationships )
61+ - [ 💡 Explanation:] ( #-explanation-14 )
62+ - [ ▶ Methods equality and identity] ( #-methods-equality-and-identity )
63+ - [ 💡 Explanation] ( #-explanation-15 )
64+ - [ ▶ All-true-ation \* ] ( #-all-true-ation- )
65+ - [ 💡 Explanation:] ( #-explanation-16 )
66+ - [ 💡 Explanation:] ( #-explanation-17 )
67+ - [ ▶ Strings and the backslashes] ( #-strings-and-the-backslashes )
68+ - [ 💡 Explanation] ( #-explanation-18 )
69+ - [ ▶ not knot!] ( #-not-knot )
70+ - [ 💡 Explanation:] ( #-explanation-19 )
71+ - [ ▶ Half triple-quoted strings] ( #-half-triple-quoted-strings )
72+ - [ 💡 Explanation:] ( #-explanation-20 )
73+ - [ ▶ What's wrong with booleans?] ( #-whats-wrong-with-booleans )
74+ - [ 💡 Explanation:] ( #-explanation-21 )
75+ - [ ▶ Class attributes and instance attributes] ( #-class-attributes-and-instance-attributes )
76+ - [ 💡 Explanation:] ( #-explanation-22 )
77+ - [ ▶ yielding None] ( #-yielding-none )
78+ - [ 💡 Explanation:] ( #-explanation-23 )
79+ - [ ▶ Yielding from... return! \* ] ( #-yielding-from-return- )
80+ - [ 💡 Explanation:] ( #-explanation-24 )
81+ - [ ▶ Nan-reflexivity \* ] ( #-nan-reflexivity- )
82+ - [ 💡 Explanation:] ( #-explanation-25 )
83+ - [ ▶ Mutating the immutable!] ( #-mutating-the-immutable )
84+ - [ 💡 Explanation:] ( #-explanation-26 )
85+ - [ ▶ The disappearing variable from outer scope] ( #-the-disappearing-variable-from-outer-scope )
86+ - [ 💡 Explanation:] ( #-explanation-27 )
87+ - [ ▶ The mysterious key type conversion] ( #-the-mysterious-key-type-conversion )
88+ - [ 💡 Explanation:] ( #-explanation-28 )
89+ - [ ▶ Let's see if you can guess this?] ( #-lets-see-if-you-can-guess-this )
90+ - [ 💡 Explanation:] ( #-explanation-29 )
91+ - [ ▶ Exceeds the limit for integer string conversion] ( #-exceeds-the-limit-for-integer-string-conversion )
92+ - [ 💡 Explanation:] ( #-explanation-30 )
93+ - [ Section: Slippery Slopes] ( #section-slippery-slopes )
94+ - [ ▶ Modifying a dictionary while iterating over it] ( #-modifying-a-dictionary-while-iterating-over-it )
95+ - [ 💡 Explanation:] ( #-explanation-31 )
96+ - [ ▶ Stubborn ` del ` operation] ( #-stubborn-del-operation )
97+ - [ 💡 Explanation:] ( #-explanation-32 )
98+ - [ ▶ The out of scope variable] ( #-the-out-of-scope-variable )
99+ - [ 💡 Explanation:] ( #-explanation-33 )
100+ - [ ▶ Deleting a list item while iterating] ( #-deleting-a-list-item-while-iterating )
101+ - [ 💡 Explanation:] ( #-explanation-34 )
102+ - [ ▶ Lossy zip of iterators \* ] ( #-lossy-zip-of-iterators- )
103+ - [ 💡 Explanation:] ( #-explanation-35 )
104+ - [ ▶ Loop variables leaking out!] ( #-loop-variables-leaking-out )
105+ - [ 💡 Explanation:] ( #-explanation-36 )
106+ - [ ▶ Beware of default mutable arguments!] ( #-beware-of-default-mutable-arguments )
107+ - [ 💡 Explanation:] ( #-explanation-37 )
108+ - [ ▶ Catching the Exceptions] ( #-catching-the-exceptions )
109+ - [ 💡 Explanation] ( #-explanation-38 )
110+ - [ ▶ Same operands, different story!] ( #-same-operands-different-story )
111+ - [ 💡 Explanation:] ( #-explanation-39 )
112+ - [ ▶ Name resolution ignoring class scope] ( #-name-resolution-ignoring-class-scope )
113+ - [ 💡 Explanation] ( #-explanation-40 )
114+ - [ ▶ Rounding like a banker \* ] ( #-rounding-like-a-banker- )
115+ - [ 💡 Explanation:] ( #-explanation-41 )
116+ - [ ▶ Needles in a Haystack \* ] ( #-needles-in-a-haystack- )
117+ - [ 💡 Explanation:] ( #-explanation-42 )
118+ - [ ▶ Splitsies \* ] ( #-splitsies- )
119+ - [ 💡 Explanation:] ( #-explanation-43 )
120+ - [ ▶ Wild imports \* ] ( #-wild-imports- )
121+ - [ 💡 Explanation:] ( #-explanation-44 )
122+ - [ ▶ All sorted? \* ] ( #-all-sorted- )
123+ - [ 💡 Explanation:] ( #-explanation-45 )
124+ - [ ▶ Midnight time doesn't exist?] ( #-midnight-time-doesnt-exist )
125+ - [ 💡 Explanation:] ( #-explanation-46 )
126+ - [ Section: The Hidden treasures!] ( #section-the-hidden-treasures )
127+ - [ ▶ Okay Python, Can you make me fly?] ( #-okay-python-can-you-make-me-fly )
128+ - [ 💡 Explanation:] ( #-explanation-47 )
129+ - [ ▶ ` goto ` , but why?] ( #-goto-but-why )
130+ - [ 💡 Explanation:] ( #-explanation-48 )
131+ - [ ▶ Brace yourself!] ( #-brace-yourself )
132+ - [ 💡 Explanation:] ( #-explanation-49 )
133+ - [ ▶ Let's meet Friendly Language Uncle For Life] ( #-lets-meet-friendly-language-uncle-for-life )
134+ - [ 💡 Explanation:] ( #-explanation-50 )
135+ - [ ▶ Even Python understands that love is complicated] ( #-even-python-understands-that-love-is-complicated )
136+ - [ 💡 Explanation:] ( #-explanation-51 )
137+ - [ ▶ Yes, it exists!] ( #-yes-it-exists )
138+ - [ 💡 Explanation:] ( #-explanation-52 )
139+ - [ ▶ Ellipsis \* ] ( #-ellipsis- )
140+ - [ 💡 Explanation] ( #-explanation-53 )
141+ - [ ▶ Inpinity] ( #-inpinity )
142+ - [ 💡 Explanation:] ( #-explanation-54 )
143+ - [ ▶ Let's mangle] ( #-lets-mangle )
144+ - [ 💡 Explanation:] ( #-explanation-55 )
145+ - [ Section: Appearances are deceptive!] ( #section-appearances-are-deceptive )
146+ - [ ▶ Skipping lines?] ( #-skipping-lines )
147+ - [ 💡 Explanation] ( #-explanation-56 )
148+ - [ ▶ Teleportation] ( #-teleportation )
149+ - [ 💡 Explanation:] ( #-explanation-57 )
150+ - [ ▶ Well, something is fishy...] ( #-well-something-is-fishy )
151+ - [ 💡 Explanation] ( #-explanation-58 )
152+ - [ Section: Miscellaneous] ( #section-miscellaneous )
153+ - [ ▶ ` += ` is faster] ( #--is-faster )
154+ - [ 💡 Explanation:] ( #-explanation-59 )
155+ - [ ▶ Let's make a giant string!] ( #-lets-make-a-giant-string )
156+ - [ 💡 Explanation] ( #-explanation-60 )
157+ - [ ▶ Slowing down ` dict ` lookups \* ] ( #-slowing-down-dict-lookups- )
158+ - [ 💡 Explanation:] ( #-explanation-61 )
159+ - [ ▶ Bloating instance ` dict ` s \* ] ( #-bloating-instance-dicts- )
160+ - [ 💡 Explanation:] ( #-explanation-62 )
161+ - [ ▶ Minor Ones \* ] ( #-minor-ones- )
100162- [ Contributing] ( #contributing )
101163- [ Acknowledgements] ( #acknowledgements )
164+ - [ Some nice Links!] ( #some-nice-links )
102165- [ 🎓 License] ( #-license )
103- * [ Surprise your friends as well!] ( #surprise-your-friends-as-well )
104- * [ More content like this ?] ( #more-content-like-this )
166+ - [ Surprise your friends as well!] ( #surprise-your-friends-as-well )
167+ - [ Need a pdf version ?] ( #need-a-pdf-version )
105168
106169<!-- tocstop -->
107170
0 commit comments