Skip to content

Commit a8bcf80

Browse files
committed
Note about fix in list comprehensions.
1 parent 1c91707 commit a8bcf80

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Misc/NEWS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ Type/class unification and new-style classes
2222

2323
Core
2424

25+
- A very subtle syntactical pitfall in list comprehensions was fixed.
26+
For example: [a+b for a in 'abc', for b in 'def']. The comma in
27+
this example is a mistake. Previously, this would silently let 'a'
28+
iterate over the singleton tuple ('abc',), yielding ['abcd', 'abce',
29+
'abcf'] rather than the intended ['ad', 'ae', 'af', 'bd', 'be',
30+
'bf', 'cd', 'ce', 'cf']. Now, this is flagged as a syntax error.
31+
Note that [a for a in <singleton>] is a convoluted way to say
32+
[<singleton>] anyway, so it's not like any expressiveness is lost.
33+
2534
- binascii has now two quopri support functions, a2b_qp and b2a_qp.
2635

2736
- readline now supports setting the startup_hook and the pre_event_hook.

0 commit comments

Comments
 (0)