Update TOC

This commit is contained in:
Satwik 2019-10-28 22:48:15 +05:30
parent 28bcbfd311
commit ce8adb0417
1 changed files with 13 additions and 15 deletions

28
README.md vendored
View File

@ -1,7 +1,6 @@
<p align="center"><img src="images/logo.png" alt=""></p> <p align="center"><img src="images/logo.png" alt=""></p>
<h1 align="center">What the f*ck Python! 🐍</h1> <h1 align="center">What the f*ck Python! 🐍</h1>
<p align="center">An interesting collection of surprising snippets and lesser-known Python features.</p> <p align="center">An interesting collection of surprising snippets and lesser-known Python features.</p>
[![WTFPL 2.0][license-image]][license-url] [![WTFPL 2.0][license-image]][license-url]
Translations: [Chinese 中文](https://github.com/leisurelicht/wtfpython-cn) Translations: [Chinese 中文](https://github.com/leisurelicht/wtfpython-cn)
@ -20,22 +19,22 @@ So, here we go...
# Table of Contents # Table of Contents
<!-- toc --> <!-- toc generated using "markdown-toc -i README.md --maxdepth 3"-->
- [Structure of the Examples](#structure-of-the-examples) - [Structure of the Examples](#structure-of-the-examples)
+ [ Some fancy Title](#-some-fancy-title) + [ Some fancy Title](#-some-fancy-title)
- [Usage](#usage) - [Usage](#usage)
- [👀 Examples](#-examples) - [👀 Examples](#%F0%9F%91%80-examples)
* [Section: Strain your brain!](#section-strain-your-brain) * [Section: Strain your brain!](#section-strain-your-brain)
+ [ Strings can be tricky sometimes](#-strings-can-be-tricky-sometimes) + [ Strings can be tricky sometimes](#-strings-can-be-tricky-sometimes)
+ [ Splitsies](#-splitsies) + [ Splitsies](#-splitsies)
+ [ Time for some hash brownies!](#-time-for-some-hash-brownies) + [ Hash brownies](#-hash-brownies)
+ [ The disorder within order](#-the-disorder-within-order) + [ Disorder within order](#-disorder-within-order)
+ [ Keep trying?](#-keep-trying) + [ Keep trying...](#-keep-trying)
+ [ Deep down, we're all the same](#-deep-down-were-all-the-same) + [ Deep down, we're all the same.](#-deep-down-were-all-the-same)
+ [ For what?](#-for-what) + [ For what?](#-for-what)
+ [ Evaluation time discrepancy](#-evaluation-time-discrepancy) + [ Evaluation time discrepancy](#-evaluation-time-discrepancy)
+ [ Messing around with `is` operator](#-messing-around-with-is-operator) + [ How not to use `is` operator](#-how-not-to-use-is-operator)
+ [ A tic-tac-toe where X wins in the first attempt!](#-a-tic-tac-toe-where-x-wins-in-the-first-attempt) + [ A tic-tac-toe where X wins in the first attempt!](#-a-tic-tac-toe-where-x-wins-in-the-first-attempt)
+ [ The sticky output function](#-the-sticky-output-function) + [ The sticky output function](#-the-sticky-output-function)
+ [ The chicken-egg problem](#-the-chicken-egg-problem) + [ The chicken-egg problem](#-the-chicken-egg-problem)
@ -51,8 +50,8 @@ So, here we go...
+ [ Mutating the immutable!](#-mutating-the-immutable) + [ Mutating the immutable!](#-mutating-the-immutable)
+ [ The disappearing variable from outer scope](#-the-disappearing-variable-from-outer-scope) + [ The disappearing variable from outer scope](#-the-disappearing-variable-from-outer-scope)
+ [ When True is actually False](#-when-true-is-actually-false) + [ When True is actually False](#-when-true-is-actually-false)
+ [ Yielding from... return!](#-yielding-from-return)
+ [ Lossy zip of iterators](#-lossy-zip-of-iterators) + [ Lossy zip of iterators](#-lossy-zip-of-iterators)
+ [ From filled to None in one instruction...](#-from-filled-to-none-in-one-instruction)
+ [ Subclass relationships](#-subclass-relationships) + [ Subclass relationships](#-subclass-relationships)
+ [ The mysterious key type conversion](#-the-mysterious-key-type-conversion) + [ 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) + [ Let's see if you can guess this?](#-lets-see-if-you-can-guess-this)
@ -88,11 +87,11 @@ So, here we go...
+ [ Let's make a giant string!](#-lets-make-a-giant-string) + [ Let's make a giant string!](#-lets-make-a-giant-string)
+ [ Explicit typecast of strings](#-explicit-typecast-of-strings) + [ Explicit typecast of strings](#-explicit-typecast-of-strings)
+ [ Minor Ones](#-minor-ones) + [ Minor Ones](#-minor-ones)
* [~~~ That's all folks! ~~~](#-thats-all-folks-)
- [Contributing](#contributing) - [Contributing](#contributing)
- [Acknowledgements](#acknowledgements) - [Acknowledgements](#acknowledgements)
- [🎓 License](#-license) - [🎓 License](#%F0%9F%8E%93-license)
* [Help](#help) * [Surprise your friends too?](#surprise-your-friends-too)
* [Surprise your geeky pythonist friends?](#surprise-your-geeky-pythonist-friends)
* [Need a pdf version?](#need-a-pdf-version) * [Need a pdf version?](#need-a-pdf-version)
<!-- tocstop --> <!-- tocstop -->
@ -361,7 +360,7 @@ What is going on here?
#### 💡 Explanation: #### 💡 Explanation:
- The reason why intransitive equality didn't hold among `dictionary`, `ordered_dict` and `another_ordered_dict` is because of the way `__eq__` method is implemented in `OrderedDict` class. From the [docs](https://docs.python.org/3/library/collections.html#ordereddict-objects) - The reason why intransitive equality didn't hold among `dictionary`, `ordered_dict` and `another_ordered_dict` is because of the way `__eq__` method is implemented in `OrderedDict` class. From the [docs](https://docs.python.org/3/library/collections.html#ordereddict-objects)
> Equality tests between OrderedDict objects are order-sensitive and are implemented as `list(od1.items())==list(od2.items())`. Equality tests between `OrderedDict` objects and other Mapping objects are order-insensitive like regular dictionaries. > Equality tests between OrderedDict objects are order-sensitive and are implemented as `list(od1.items())==list(od2.items())`. Equality tests between `OrderedDict` objects and other Mapping objects are order-insensitive like regular dictionaries.
- The reason for this equality is behavior is that it allows `OrderedDict` objects to be directly substituted anywhere a regular dictionary is used. - The reason for this equality is behavior is that it allows `OrderedDict` objects to be directly substituted anywhere a regular dictionary is used.
- Okay, so why did changing the order affect the lenght of the generated `set` object? The answer is the lack of intransitive equality only. Since sets are "unordered" collections of unique elements, the order in which elements are inserted shouldn't matter. But in this case, it does matter. Let's break it down a bit, - Okay, so why did changing the order affect the lenght of the generated `set` object? The answer is the lack of intransitive equality only. Since sets are "unordered" collections of unique elements, the order in which elements are inserted shouldn't matter. But in this case, it does matter. Let's break it down a bit,
@ -2937,7 +2936,7 @@ Let's increase the number of iterations by a factor of 10.
9 ms ± 298 µs per loop (mean ± std. dev. of 7 runs, 100 loops each) 9 ms ± 298 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
``` ```
- So many ways to format and create a giant string are somewhat in contrast to the [Zen of Python](https://www.python.org/dev/peps/pep-0020/), according to which, - So many ways to format and create a giant string are somewhat in contrast to the [Zen of Python](https://www.python.org/dev/peps/pep-0020/), according to which,
> There should be one-- and preferably only one --obvious way to do it. > There should be one-- and preferably only one --obvious way to do it.
--- ---
@ -3062,7 +3061,6 @@ nan
--- ---
<center>~~~ That's all folks! ~~~</center> <center>~~~ That's all folks! ~~~</center>
--- ---
# Contributing # Contributing