|
|
|
|
|
by recursive
3347 days ago
|
|
> I like lambda a, b: a + b syntax better than lambda a_b: a_b[0] + a_b[1] It already works this way. Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> add = lambda a, b: a + b
>>> add(1, 2)
3
> I prefer map/reduce/filter to return lists rather than iterableYou can produce a list from any iterable by passing it to `list()`. You cannot take a materialized list and make it lazy though. > I prefer dict.keys/values/items to return sets/lists rather than iterables, unless I call dict.iter[keys/values/items] Why? Sets are mutable. What happens when you mutate dict.values? It doesn't make sense. |
|