@@ -165,7 +165,7 @@ Now, just run `wtfpython` at the command line which will open this collection in
165
165
166
166
# # Section: Strain your brain!
167
167
168
- # ## ▶ First things first!
168
+ # ## ▶ First things first! *
169
169
170
170
< !-- Example ID : d3d73936- 3cf1 - 4632 - b5ab- 817981338863 -- >
171
171
< !-- read- only -- >
451
451
452
452
-- -
453
453
454
- # ## ▶ Disorder within order
454
+ # ## ▶ Disorder within order *
455
455
< !-- Example ID : 91bff1f8 - 541d - 455a - 9de4 - 6cd8ff00ea66 -- ->
456
456
```py
457
457
from collections import OrderedDict
@@ -549,7 +549,7 @@ What is going on here?
549
549
550
550
-- -
551
551
552
- # ## ▶ Keep trying...
552
+ # ## ▶ Keep trying... *
553
553
< !-- Example ID : b4349443- e89f- 4d25 - a109- 82616be9d41a -- ->
554
554
```py
555
555
def some_func():
@@ -976,7 +976,7 @@ Even when the values of `x` were different in every iteration prior to appending
976
976
977
977
-- -
978
978
979
- # ## ▶ The chicken-egg problem
979
+ # ## ▶ The chicken-egg problem *
980
980
< !-- Example ID : 60730dc2 - 0d79 - 4416 - 8568 - 2a63323b3ce8 -- ->
981
981
1 \.
982
982
```py
@@ -1050,7 +1050,7 @@ The Subclass relationships were expected to be transitive, right? (i.e., if `A`
1050
1050
1051
1051
-- -
1052
1052
1053
- # ## ▶ All-true-ation
1053
+ # ## ▶ All-true-ation *
1054
1054
1055
1055
< !-- Example ID : dfe6d845- e452- 48fe - a2da- 0ed3869a8042 -- >
1056
1056
@@ -1379,7 +1379,7 @@ True
1379
1379
1380
1380
---
1381
1381
1382
- ### ▶ Non-reflexive class method
1382
+ ### ▶ Non-reflexive class method *
1383
1383
1384
1384
<!-- Example ID: 3649771a-f733-413c-8060-3f9f167b83fd -->
1385
1385
@@ -1455,7 +1455,7 @@ def some_func(val):
1455
1455
---
1456
1456
1457
1457
1458
- ### ▶ Yielding from... return!
1458
+ ### ▶ Yielding from... return! *
1459
1459
<!-- Example ID: 5626d8ef-8802-49c2-adbc-7cda5c550816 --->
1460
1460
1\.
1461
1461
@@ -1520,7 +1520,7 @@ Same result, that didn't work either.
1520
1520
1521
1521
---
1522
1522
1523
- ### ▶ Nan-reflexivity
1523
+ ### ▶ Nan-reflexivity *
1524
1524
1525
1525
<!-- Example ID: 59bee91a-36e0-47a4-8c7d-aa89bf1d3976 --->
1526
1526
@@ -2012,8 +2012,7 @@ Can you guess why the output is `[2, 4]`?
2012
2012
---
2013
2013
2014
2014
2015
- ### ▶ Lossy zip of iterators
2016
-
2015
+ ### ▶ Lossy zip of iterators *
2017
2016
<!-- Example ID: c28ed154-e59f-4070-8eb6-8967a4acac6d --->
2018
2017
2019
2018
```py
@@ -2390,7 +2389,7 @@ class SomeClass:
2390
2389
2391
2390
---
2392
2391
2393
- ### ▶ Needles in a Haystack
2392
+ ### ▶ Needles in a Haystack *
2394
2393
2395
2394
<!-- Example ID: 52a199b1-989a-4b28-8910-dff562cebba9 --->
2396
2395
@@ -2567,7 +2566,7 @@ def similar_recursive_func(a):
2567
2566
---
2568
2567
2569
2568
2570
- ### ▶ Splitsies
2569
+ ### ▶ Splitsies *
2571
2570
<!-- Example ID: ec3168ba-a81a-4482-afb0-691f1cc8d65a --->
2572
2571
```py
2573
2572
>>> 'a'.split()
@@ -2603,7 +2602,7 @@ def similar_recursive_func(a):
2603
2602
2604
2603
---
2605
2604
2606
- ### ▶ Wild imports
2605
+ ### ▶ Wild imports *
2607
2606
<!-- Example ID: 83deb561-bd55-4461-bb5e-77dd7f411e1c --->
2608
2607
<!-- read-only -->
2609
2608
@@ -2662,7 +2661,7 @@ NameError: name '_another_weird_name_func' is not defined
2662
2661
2663
2662
---
2664
2663
2665
- ### ▶ All sorted?
2664
+ ### ▶ All sorted? *
2666
2665
2667
2666
<!-- Example ID: e5ff1eaf-8823-4738-b4ce-b73f7c9d5511 -->
2668
2667
@@ -2767,7 +2766,7 @@ from goto import goto, label
2767
2766
for i in range(9):
2768
2767
for j in range(9):
2769
2768
for k in range(9):
2770
- print("I'm trapped, please rescue!")
2769
+ print("I am trapped, please rescue!")
2771
2770
if k == 2:
2772
2771
goto .breakout # breaking out from a deeply nested loop
2773
2772
label .breakout
@@ -2776,8 +2775,8 @@ print("Freedom!")
2776
2775
2777
2776
**Output (Python 2.3):**
2778
2777
```py
2779
- I'm trapped, please rescue!
2780
- I'm trapped, please rescue!
2778
+ I am trapped, please rescue!
2779
+ I am trapped, please rescue!
2781
2780
Freedom!
2782
2781
```
2783
2782
@@ -2945,7 +2944,7 @@ Try block executed successfully...
2945
2944
- `else` clause after try block is also called "completion clause" as reaching the `else` clause in a `try` statement means that the try block actually completed successfully.
2946
2945
2947
2946
---
2948
- ### ▶ Ellipsis
2947
+ ### ▶ Ellipsis *
2949
2948
<!-- Example ID: 969b7100-ab3d-4a7d-ad7d-a6be16181b2b --->
2950
2949
```py
2951
2950
def some_func():
@@ -3324,7 +3323,7 @@ Let's increase the number of iterations by a factor of 10.
3324
3323
3325
3324
---
3326
3325
3327
- ### ▶ Minor Ones
3326
+ ### ▶ Minor Ones *
3328
3327
<!-- Example ID: f885cb82-f1e4-4daa-9ff3-972b14cb1324 --->
3329
3328
* `join()` is a string operation instead of list operation. (sort of counter-intuitive at first usage)
3330
3329
@@ -3512,7 +3511,7 @@ The idea and design for this collection were initially inspired by Denys Dovhan'
3512
3511
3513
3512
If you liked wtfpython, you can use these quick links to share it with your friends,
3514
3513
3515
- [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 %20i nteresting %20c ollection %20o f %20s ubtle %20a nd%20tricky% 20Python%20s nippets. )
3514
+ [Twitter](https://twitter.com/intent/tweet?url=https://github.com/satwikkansal/wtfpython&text=If%20you %20r eally%20think%20you%20know%20Python,%20think %20o nce%20more!%20Check %20o ut%20wtfpython& hastags=python,wtfpython) | [Linkedin](https://www.linkedin.com/shareArticle?url=https://github.com/satwikkansal&title=What%20the%20f *ck%20Python!&summary=If%20you %20r eally%20thing%20you%20know% 20Python,%20think %20o nce%20more!) | [Facebook](https://www.facebook.com/dialog/share?app_id=536779657179021&display=page&href=https%3A %2F%2F github.com %2F satwikkansal %2F wtfpython"e=If%20you %20r eally%20think%20you%20know%20Python%2C%20think %20o nce%20more! )
3516
3515
3517
3516
## Need a pdf version?
3518
3517
0 commit comments