Light Mode
Dark Mode
different orders of ternary operands

1st

flatlist = lambda e: type(e) == list and sum( map( flatlist, e ), [] ) or [e]

2nd

flatlist = lambda e: type(e) != list and [e] or sum( map( flatlist, e ), [] )

#

when [] is given, the 1st returns [[]]

but the 2nd returns []

Why!?!

Created: May 9, 2019, 12:03 a.m.
Updated: May 13, 2019, 5:25 a.m.
0
7
User avatar
sbbaik