@@ -83,14 +83,16 @@ So, here ya go...
83
83
- [ 💡 Explanation:] ( #-explanation-18 )
84
84
- [ Needle in a Haystack] ( #needle-in-a-haystack )
85
85
- [ 💡 Explanation:] ( #-explanation-19 )
86
- - [ The surprising comma ] ( #the-surprising-comma )
86
+ - [ yielding None ] ( #yielding-none )
87
87
- [ 💡 Explanation:] ( #-explanation-20 )
88
- - [ For what? ] ( #for-what )
88
+ - [ The surprising comma ] ( #the-surprising-comma )
89
89
- [ 💡 Explanation:] ( #-explanation-21 )
90
- - [ not knot! ] ( #not-knot )
90
+ - [ For what? ] ( #for-what )
91
91
- [ 💡 Explanation:] ( #-explanation-22 )
92
- - [ Let's see if you can guess this? ] ( #lets-see-if-you-can-guess-this )
92
+ - [ not knot! ] ( #not-knot )
93
93
- [ 💡 Explanation:] ( #-explanation-23 )
94
+ - [ Let's see if you can guess this?] ( #lets-see-if-you-can-guess-this )
95
+ - [ 💡 Explanation:] ( #-explanation-24 )
94
96
- [ Minor Ones] ( #minor-ones )
95
97
- [ TODO: Hell of an example!] ( #todo-hell-of-an-example )
96
98
- [ Contributing] ( #contributing )
@@ -1491,6 +1493,38 @@ tuple()
1491
1493
1492
1494
-- -
1493
1495
1496
+ # ## yielding None
1497
+
1498
+ Suggested by @ chris- rands in [this](https:// github.com/ satwikkansal/ wtfpython/ issues/ 32 ) issue.
1499
+
1500
+ ```py
1501
+ some_iterable = (' a' , ' b' )
1502
+
1503
+ def some_func(val):
1504
+ return " something"
1505
+ ```
1506
+
1507
+
1508
+ ** Output:**
1509
+ ```py
1510
+ >> > [x for x in some_iterable]
1511
+ [' a' , ' b' ]
1512
+ >> > [(yield x) for x in some_iterable]
1513
+ < generator object < listcomp> at 0x 7f70b0a4ad58>
1514
+ >> > list ([(yield x) for x in some_iterable])
1515
+ [' a' , ' b' ]
1516
+ >> > list ((yield x) for x in some_iterable)
1517
+ [' a' , None , ' b' , None ]
1518
+ >> > list (some_func((yield x)) for x in some_iterable)
1519
+ [' a' , ' something' , ' b' , ' something' ]
1520
+ ```
1521
+
1522
+ # ### 💡 Explanation:
1523
+ - Source and explanation can be found here: https:// stackoverflow.com/ questions/ 32139885 / yield - in - list - comprehensions- and - generator- expressions
1524
+ - Related bug report: http:// bugs.python.org/ issue10544
1525
+
1526
+ -- -
1527
+
1494
1528
# ## The surprising comma
1495
1529
1496
1530
Suggested by @ MostAwesomeDude in [this](https:// github.com/ satwikkansal/ wtfPython/ issues/ 1 ) issue.
0 commit comments