mirror of
https://github.com/satwikkansal/wtfpython
synced 2024-11-22 02:54:25 +01:00
Revert README.md
This commit is contained in:
parent
b6fd12efa2
commit
39595fc35f
209
README.md
vendored
209
README.md
vendored
@ -2,7 +2,7 @@
|
|||||||
<h1 align="center">What the f*ck Python! 😱</h1>
|
<h1 align="center">What the f*ck Python! 😱</h1>
|
||||||
<p align="center">Exploring and understanding Python through surprising snippets.</p>
|
<p align="center">Exploring and understanding Python through surprising snippets.</p>
|
||||||
|
|
||||||
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].)
|
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].)
|
||||||
|
|
||||||
Other 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)
|
Other 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)
|
||||||
|
|
||||||
@ -24,147 +24,84 @@ So, here we go...
|
|||||||
|
|
||||||
<!-- toc -->
|
<!-- toc -->
|
||||||
|
|
||||||
- [Table of Contents](#table-of-contents)
|
|
||||||
- [Structure of the Examples](#structure-of-the-examples)
|
- [Structure of the Examples](#structure-of-the-examples)
|
||||||
|
+ [▶ Some fancy Title](#-some-fancy-title)
|
||||||
- [Usage](#usage)
|
- [Usage](#usage)
|
||||||
- [👀 Examples](#-examples)
|
- [👀 Examples](#-examples)
|
||||||
- [Section: Strain your brain!](#section-strain-your-brain)
|
* [Section: Strain your brain!](#section-strain-your-brain)
|
||||||
- [▶ First things first! \*](#-first-things-first-)
|
+ [▶ First things first! *](#-first-things-first-)
|
||||||
- [💡 Explanation](#-explanation)
|
+ [▶ Strings can be tricky sometimes](#-strings-can-be-tricky-sometimes)
|
||||||
- [▶ Strings can be tricky sometimes](#-strings-can-be-tricky-sometimes)
|
+ [▶ Be careful with chained operations](#-be-careful-with-chained-operations)
|
||||||
- [💡 Explanation:](#-explanation-1)
|
+ [▶ How not to use `is` operator](#-how-not-to-use-is-operator)
|
||||||
- [▶ Be careful with chained operations](#-be-careful-with-chained-operations)
|
+ [▶ Hash brownies](#-hash-brownies)
|
||||||
- [💡 Explanation:](#-explanation-2)
|
+ [▶ Deep down, we're all the same.](#-deep-down-were-all-the-same)
|
||||||
- [▶ How not to use `is` operator](#-how-not-to-use-is-operator)
|
+ [▶ Disorder within order *](#-disorder-within-order-)
|
||||||
- [💡 Explanation:](#-explanation-3)
|
+ [▶ Keep trying... *](#-keep-trying-)
|
||||||
- [▶ Hash brownies](#-hash-brownies)
|
+ [▶ For what?](#-for-what)
|
||||||
- [💡 Explanation](#-explanation-4)
|
+ [▶ Evaluation time discrepancy](#-evaluation-time-discrepancy)
|
||||||
- [▶ Deep down, we're all the same.](#-deep-down-were-all-the-same)
|
+ [▶ `is not ...` is not `is (not ...)`](#-is-not--is-not-is-not-)
|
||||||
- [💡 Explanation:](#-explanation-5)
|
+ [▶ A tic-tac-toe where X wins in the first attempt!](#-a-tic-tac-toe-where-x-wins-in-the-first-attempt)
|
||||||
- [▶ Disorder within order \*](#-disorder-within-order-)
|
+ [▶ Schrödinger's variable](#-schrödingers-variable-)
|
||||||
- [💡 Explanation:](#-explanation-6)
|
+ [▶ The chicken-egg problem *](#-the-chicken-egg-problem-)
|
||||||
- [▶ Keep trying... \*](#-keep-trying-)
|
+ [▶ Subclass relationships](#-subclass-relationships)
|
||||||
- [💡 Explanation:](#-explanation-7)
|
+ [▶ Methods equality and identity](#-methods-equality-and-identity)
|
||||||
- [▶ For what?](#-for-what)
|
+ [▶ All-true-ation *](#-all-true-ation-)
|
||||||
- [💡 Explanation:](#-explanation-8)
|
+ [▶ The surprising comma](#-the-surprising-comma)
|
||||||
- [▶ Evaluation time discrepancy](#-evaluation-time-discrepancy)
|
+ [▶ Strings and the backslashes](#-strings-and-the-backslashes)
|
||||||
- [💡 Explanation](#-explanation-9)
|
+ [▶ not knot!](#-not-knot)
|
||||||
- [▶ `is not ...` is not `is (not ...)`](#-is-not--is-not-is-not-)
|
+ [▶ Half triple-quoted strings](#-half-triple-quoted-strings)
|
||||||
- [💡 Explanation](#-explanation-10)
|
+ [▶ What's wrong with booleans?](#-whats-wrong-with-booleans)
|
||||||
- [▶ A tic-tac-toe where X wins in the first attempt!](#-a-tic-tac-toe-where-x-wins-in-the-first-attempt)
|
+ [▶ Class attributes and instance attributes](#-class-attributes-and-instance-attributes)
|
||||||
- [💡 Explanation:](#-explanation-11)
|
+ [▶ yielding None](#-yielding-none)
|
||||||
- [▶ Schrödinger's variable \*](#-schrödingers-variable-)
|
+ [▶ Yielding from... return! *](#-yielding-from-return-)
|
||||||
- [💡 Explanation:](#-explanation-12)
|
+ [▶ Nan-reflexivity *](#-nan-reflexivity-)
|
||||||
- [▶ The chicken-egg problem \*](#-the-chicken-egg-problem-)
|
+ [▶ Mutating the immutable!](#-mutating-the-immutable)
|
||||||
- [💡 Explanation](#-explanation-13)
|
+ [▶ The disappearing variable from outer scope](#-the-disappearing-variable-from-outer-scope)
|
||||||
- [▶ Subclass relationships](#-subclass-relationships)
|
+ [▶ The mysterious key type conversion](#-the-mysterious-key-type-conversion)
|
||||||
- [💡 Explanation:](#-explanation-14)
|
+ [▶ Let's see if you can guess this?](#-lets-see-if-you-can-guess-this)
|
||||||
- [▶ Methods equality and identity](#-methods-equality-and-identity)
|
+ [▶ Exceeds the limit for integer string conversion](#-exceeds-the-limit-for-integer-string-conversion)
|
||||||
- [💡 Explanation](#-explanation-15)
|
* [Section: Slippery Slopes](#section-slippery-slopes)
|
||||||
- [▶ All-true-ation \*](#-all-true-ation-)
|
+ [▶ Modifying a dictionary while iterating over it](#-modifying-a-dictionary-while-iterating-over-it)
|
||||||
- [💡 Explanation:](#-explanation-16)
|
+ [▶ Stubborn `del` operation](#-stubborn-del-operation)
|
||||||
- [💡 Explanation:](#-explanation-17)
|
+ [▶ The out of scope variable](#-the-out-of-scope-variable)
|
||||||
- [▶ Strings and the backslashes](#-strings-and-the-backslashes)
|
+ [▶ Deleting a list item while iterating](#-deleting-a-list-item-while-iterating)
|
||||||
- [💡 Explanation](#-explanation-18)
|
+ [▶ Lossy zip of iterators *](#-lossy-zip-of-iterators-)
|
||||||
- [▶ not knot!](#-not-knot)
|
+ [▶ Loop variables leaking out!](#-loop-variables-leaking-out)
|
||||||
- [💡 Explanation:](#-explanation-19)
|
+ [▶ Beware of default mutable arguments!](#-beware-of-default-mutable-arguments)
|
||||||
- [▶ Half triple-quoted strings](#-half-triple-quoted-strings)
|
+ [▶ Catching the Exceptions](#-catching-the-exceptions)
|
||||||
- [💡 Explanation:](#-explanation-20)
|
+ [▶ Same operands, different story!](#-same-operands-different-story)
|
||||||
- [▶ What's wrong with booleans?](#-whats-wrong-with-booleans)
|
+ [▶ Name resolution ignoring class scope](#-name-resolution-ignoring-class-scope)
|
||||||
- [💡 Explanation:](#-explanation-21)
|
+ [▶ Rounding like a banker *](#-rounding-like-a-banker-)
|
||||||
- [▶ Class attributes and instance attributes](#-class-attributes-and-instance-attributes)
|
+ [▶ Needles in a Haystack *](#-needles-in-a-haystack-)
|
||||||
- [💡 Explanation:](#-explanation-22)
|
+ [▶ Splitsies *](#-splitsies-)
|
||||||
- [▶ yielding None](#-yielding-none)
|
+ [▶ Wild imports *](#-wild-imports-)
|
||||||
- [💡 Explanation:](#-explanation-23)
|
+ [▶ All sorted? *](#-all-sorted-)
|
||||||
- [▶ Yielding from... return! \*](#-yielding-from-return-)
|
+ [▶ Midnight time doesn't exist?](#-midnight-time-doesnt-exist)
|
||||||
- [💡 Explanation:](#-explanation-24)
|
* [Section: The Hidden treasures!](#section-the-hidden-treasures)
|
||||||
- [▶ Nan-reflexivity \*](#-nan-reflexivity-)
|
+ [▶ Okay Python, Can you make me fly?](#-okay-python-can-you-make-me-fly)
|
||||||
- [💡 Explanation:](#-explanation-25)
|
+ [▶ `goto`, but why?](#-goto-but-why)
|
||||||
- [▶ Mutating the immutable!](#-mutating-the-immutable)
|
+ [▶ Brace yourself!](#-brace-yourself)
|
||||||
- [💡 Explanation:](#-explanation-26)
|
+ [▶ Let's meet Friendly Language Uncle For Life](#-lets-meet-friendly-language-uncle-for-life)
|
||||||
- [▶ The disappearing variable from outer scope](#-the-disappearing-variable-from-outer-scope)
|
+ [▶ Even Python understands that love is complicated](#-even-python-understands-that-love-is-complicated)
|
||||||
- [💡 Explanation:](#-explanation-27)
|
+ [▶ Yes, it exists!](#-yes-it-exists)
|
||||||
- [▶ The mysterious key type conversion](#-the-mysterious-key-type-conversion)
|
+ [▶ Ellipsis *](#-ellipsis-)
|
||||||
- [💡 Explanation:](#-explanation-28)
|
+ [▶ Inpinity](#-inpinity)
|
||||||
- [▶ Let's see if you can guess this?](#-lets-see-if-you-can-guess-this)
|
+ [▶ Let's mangle](#-lets-mangle)
|
||||||
- [💡 Explanation:](#-explanation-29)
|
* [Section: Appearances are deceptive!](#section-appearances-are-deceptive)
|
||||||
- [▶ Exceeds the limit for integer string conversion](#-exceeds-the-limit-for-integer-string-conversion)
|
+ [▶ Skipping lines?](#-skipping-lines)
|
||||||
- [💡 Explanation:](#-explanation-30)
|
+ [▶ Teleportation](#-teleportation)
|
||||||
- [Section: Slippery Slopes](#section-slippery-slopes)
|
+ [▶ Well, something is fishy...](#-well-something-is-fishy)
|
||||||
- [▶ Modifying a dictionary while iterating over it](#-modifying-a-dictionary-while-iterating-over-it)
|
* [Section: Miscellaneous](#section-miscellaneous)
|
||||||
- [💡 Explanation:](#-explanation-31)
|
+ [▶ `+=` is faster](#--is-faster)
|
||||||
- [▶ Stubborn `del` operation](#-stubborn-del-operation)
|
+ [▶ Let's make a giant string!](#-lets-make-a-giant-string)
|
||||||
- [💡 Explanation:](#-explanation-32)
|
+ [▶ Slowing down `dict` lookups *](#-slowing-down-dict-lookups-)
|
||||||
- [▶ The out of scope variable](#-the-out-of-scope-variable)
|
+ [▶ Bloating instance `dict`s *](#-bloating-instance-dicts-)
|
||||||
- [💡 Explanation:](#-explanation-33)
|
+ [▶ Minor Ones *](#-minor-ones-)
|
||||||
- [▶ Deleting a list item while iterating](#-deleting-a-list-item-while-iterating)
|
|
||||||
- [💡 Explanation:](#-explanation-34)
|
|
||||||
- [▶ Lossy zip of iterators \*](#-lossy-zip-of-iterators-)
|
|
||||||
- [💡 Explanation:](#-explanation-35)
|
|
||||||
- [▶ Loop variables leaking out!](#-loop-variables-leaking-out)
|
|
||||||
- [💡 Explanation:](#-explanation-36)
|
|
||||||
- [▶ Beware of default mutable arguments!](#-beware-of-default-mutable-arguments)
|
|
||||||
- [💡 Explanation:](#-explanation-37)
|
|
||||||
- [▶ Catching the Exceptions](#-catching-the-exceptions)
|
|
||||||
- [💡 Explanation](#-explanation-38)
|
|
||||||
- [▶ Same operands, different story!](#-same-operands-different-story)
|
|
||||||
- [💡 Explanation:](#-explanation-39)
|
|
||||||
- [▶ Name resolution ignoring class scope](#-name-resolution-ignoring-class-scope)
|
|
||||||
- [💡 Explanation](#-explanation-40)
|
|
||||||
- [▶ Rounding like a banker \*](#-rounding-like-a-banker-)
|
|
||||||
- [💡 Explanation:](#-explanation-41)
|
|
||||||
- [▶ Needles in a Haystack \*](#-needles-in-a-haystack-)
|
|
||||||
- [💡 Explanation:](#-explanation-42)
|
|
||||||
- [▶ Splitsies \*](#-splitsies-)
|
|
||||||
- [💡 Explanation:](#-explanation-43)
|
|
||||||
- [▶ Wild imports \*](#-wild-imports-)
|
|
||||||
- [💡 Explanation:](#-explanation-44)
|
|
||||||
- [▶ All sorted? \*](#-all-sorted-)
|
|
||||||
- [💡 Explanation:](#-explanation-45)
|
|
||||||
- [▶ Midnight time doesn't exist?](#-midnight-time-doesnt-exist)
|
|
||||||
- [💡 Explanation:](#-explanation-46)
|
|
||||||
- [Section: The Hidden treasures!](#section-the-hidden-treasures)
|
|
||||||
- [▶ Okay Python, Can you make me fly?](#-okay-python-can-you-make-me-fly)
|
|
||||||
- [💡 Explanation:](#-explanation-47)
|
|
||||||
- [▶ `goto`, but why?](#-goto-but-why)
|
|
||||||
- [💡 Explanation:](#-explanation-48)
|
|
||||||
- [▶ Brace yourself!](#-brace-yourself)
|
|
||||||
- [💡 Explanation:](#-explanation-49)
|
|
||||||
- [▶ Let's meet Friendly Language Uncle For Life](#-lets-meet-friendly-language-uncle-for-life)
|
|
||||||
- [💡 Explanation:](#-explanation-50)
|
|
||||||
- [▶ Even Python understands that love is complicated](#-even-python-understands-that-love-is-complicated)
|
|
||||||
- [💡 Explanation:](#-explanation-51)
|
|
||||||
- [▶ Yes, it exists!](#-yes-it-exists)
|
|
||||||
- [💡 Explanation:](#-explanation-52)
|
|
||||||
- [▶ Ellipsis \*](#-ellipsis-)
|
|
||||||
- [💡 Explanation](#-explanation-53)
|
|
||||||
- [▶ Inpinity](#-inpinity)
|
|
||||||
- [💡 Explanation:](#-explanation-54)
|
|
||||||
- [▶ Let's mangle](#-lets-mangle)
|
|
||||||
- [💡 Explanation:](#-explanation-55)
|
|
||||||
- [Section: Appearances are deceptive!](#section-appearances-are-deceptive)
|
|
||||||
- [▶ Skipping lines?](#-skipping-lines)
|
|
||||||
- [💡 Explanation](#-explanation-56)
|
|
||||||
- [▶ Teleportation](#-teleportation)
|
|
||||||
- [💡 Explanation:](#-explanation-57)
|
|
||||||
- [▶ Well, something is fishy...](#-well-something-is-fishy)
|
|
||||||
- [💡 Explanation](#-explanation-58)
|
|
||||||
- [Section: Miscellaneous](#section-miscellaneous)
|
|
||||||
- [▶ `+=` is faster](#--is-faster)
|
|
||||||
- [💡 Explanation:](#-explanation-59)
|
|
||||||
- [▶ Let's make a giant string!](#-lets-make-a-giant-string)
|
|
||||||
- [💡 Explanation](#-explanation-60)
|
|
||||||
- [▶ Slowing down `dict` lookups \*](#-slowing-down-dict-lookups-)
|
|
||||||
- [💡 Explanation:](#-explanation-61)
|
|
||||||
- [▶ Bloating instance `dict`s \*](#-bloating-instance-dicts-)
|
|
||||||
- [💡 Explanation:](#-explanation-62)
|
|
||||||
- [▶ Minor Ones \*](#-minor-ones-)
|
|
||||||
- [Contributing](#contributing)
|
- [Contributing](#contributing)
|
||||||
- [Acknowledgements](#acknowledgements)
|
- [Acknowledgements](#acknowledgements)
|
||||||
- [Some nice Links!](#some-nice-links)
|
|
||||||
- [🎓 License](#-license)
|
- [🎓 License](#-license)
|
||||||
- [Surprise your friends as well!](#surprise-your-friends-as-well)
|
* [Surprise your friends as well!](#surprise-your-friends-as-well)
|
||||||
- [Need a pdf version?](#need-a-pdf-version)
|
* [More content like this?](#more-content-like-this)
|
||||||
|
|
||||||
<!-- tocstop -->
|
<!-- tocstop -->
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user