From 39595fc35f5538040c825f28f191926707a84fa9 Mon Sep 17 00:00:00 2001 From: Vadim Nifadev <36514612+nifadyev@users.noreply.github.com> Date: Sat, 4 May 2024 20:03:28 +0300 Subject: [PATCH] Revert README.md --- README.md | 209 +++++++++++++++++++----------------------------------- 1 file changed, 73 insertions(+), 136 deletions(-) diff --git a/README.md b/README.md index 0d3fd48..bb3100f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

What the f*ck Python! 😱

Exploring and understanding Python through surprising snippets.

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