4 ms·
That list comprehension though. Could be useful to math-fluent newcomers.
by fenollp 10y ago
That list comprehension though. Could be useful to math-fluent newcomers.
- contravariant 10y agoWhat list comprehension? I don't see any. Besides, python list comprehension isn't that far from the mathematical version. Compare: { x^2 : x in Z, x^2 > 10 } with [ x^2 for x in Z if x^2 > 10 ] The main problem is that you can't have a list of all positive integers, so you're kind of forced to make it a generator instead. And the standard set notation clashes a bit with the notation of dictionaries, but on the whole it's not that bad.
- qrian 10y agoIt's there at the first defined function. $$any(code \notin api\_codes \forall code \in codes)$$