@@ -1799,8 +1799,6 @@ tuple()
1799
1799
1800
1800
# ## Teleportation
1801
1801
1802
- Suggested in [this](https:// www.reddit.com/ r/ Python/ comments/ 6x6upn / wtfpython_a_collection_of_interesting_and_tricky/ dme96dq/ ) reddit thread.
1803
-
1804
1802
```py
1805
1803
import numpy as np
1806
1804
@@ -1831,8 +1829,6 @@ Is it worth a Nobel Prize?
1831
1829
1832
1830
# ## yielding None
1833
1831
1834
- Suggested by @ chris- rands in [this](https:// github.com/ satwikkansal/ wtfpython/ issues/ 32 ) issue.
1835
-
1836
1832
```py
1837
1833
some_iterable = (' a' , ' b' )
1838
1834
@@ -1863,8 +1859,6 @@ def some_func(val):
1863
1859
1864
1860
# ## The surprising comma
1865
1861
1866
- Suggested by @ MostAwesomeDude in [this](https:// github.com/ satwikkansal/ wtfPython/ issues/ 1 ) issue.
1867
-
1868
1862
** Output:**
1869
1863
```py
1870
1864
>> > def f(x, y,):
@@ -1895,8 +1889,6 @@ SyntaxError: invalid syntax
1895
1889
1896
1890
# ## For what?
1897
1891
1898
- Suggested by @ MittalAshok in [this](https:// github.com/ satwikkansal/ wtfpython/ issues/ 23 ) issue.
1899
-
1900
1892
```py
1901
1893
some_string = " wtf"
1902
1894
some_dict = {}
@@ -1917,7 +1909,7 @@ for i, some_dict[i] in enumerate(some_string):
1917
1909
for_stmt: ' for' exprlist ' in' testlist ' :' suite [' else' ' :' suite]
1918
1910
```
1919
1911
Where `exprlist` is the assignment target. This means that the equivalent of `{exprlist} = {next_value}` is ** executed for each item** in the iterable.
1920
- An interesting example suggested by @ tukkek in [this](https: // github.com / satwikkansal / wtfPython / issues / 11 ) issue illustrates this:
1912
+ An interesting example that illustrates this:
1921
1913
```py
1922
1914
for i in range (4 ):
1923
1915
print (i)
@@ -1950,8 +1942,6 @@ for i, some_dict[i] in enumerate(some_string):
1950
1942
1951
1943
# ## not knot!
1952
1944
1953
- Suggested by @ MostAwesomeDude in [this](https:// github.com/ satwikkansal/ wtfPython/ issues/ 1 ) issue.
1954
-
1955
1945
```py
1956
1946
x = True
1957
1947
y = False
@@ -1979,8 +1969,6 @@ SyntaxError: invalid syntax
1979
1969
1980
1970
# ## Subclass relationships
1981
1971
1982
- Suggested by @ Lucas- C in [this](https:// github.com/ satwikkansal/ wtfpython/ issues/ 36 ) issue.
1983
-
1984
1972
** Output:**
1985
1973
```py
1986
1974
>> > from collections import Hashable
@@ -2005,8 +1993,6 @@ The Subclass relationships were expected to be transitive, right? (i.e. if `A` i
2005
1993
2006
1994
# ## Mangling time!
2007
1995
2008
- Suggested by @ Lucas- C in [this](https:// github.com/ satwikkansal/ wtfpython/ issues/ 36 ) issue.
2009
-
2010
1996
2011
1997
```py
2012
1998
class Yo(object ):
@@ -2037,9 +2023,6 @@ Why did `Yo()._Yo__honey` worked? Only Indian readers would understand.
2037
2023
2038
2024
# ## Deep down, we're all the same.
2039
2025
2040
- Suggested by @ Lucas- C in [this](https:// github.com/ satwikkansal/ wtfpython/ issues/ 36 ) issue.
2041
-
2042
-
2043
2026
```py
2044
2027
class WTF :
2045
2028
pass
@@ -2083,8 +2066,6 @@ True
2083
2066
2084
2067
# ## Half triple-quoted strings
2085
2068
2086
- Suggested by @ asottile in [this](https:// github.com/ satwikkansal/ wtfpython/ issues/ 40 ) issue.
2087
-
2088
2069
** Output:**
2089
2070
```py
2090
2071
>> > print (' wtfpython' ' ' )
@@ -2166,8 +2147,6 @@ str
2166
2147
2167
2148
### Stubborn `del` operator
2168
2149
2169
- Suggested by @tukkek in [this](https://github.com/satwikkansal/wtfpython/issues/26) issue.
2170
-
2171
2150
```py
2172
2151
class SomeClass:
2173
2152
def __del__(self):
@@ -2211,8 +2190,6 @@ Okay, now it's deleted :confused:
2211
2190
2212
2191
### Let's see if you can guess this?
2213
2192
2214
- Suggested by @PiaFraus in [this](https://github.com/satwikkansal/wtfPython/issues/9) issue.
2215
-
2216
2193
```py
2217
2194
a, b = a[b] = {}, 5
2218
2195
```
0 commit comments