List comprehension
S = { 2*x | x ∈ (1..100) , x^2 >3 }
1 | S = [2 * x for x in range(101) if x ** 2 > 3] |
1 | ## python -mtimeit -s'xs=range(10)' 'map(hex, xs)' |
1 | ## python -mtimeit -s'i=[1000,2000,3000]' 'j=[10,20,30]' '[m + n for m, n in zip(i ,j)]' |
List comprehension
S = { 2*x | x ∈ (1..100) , x^2 >3 }
1 | S = [2 * x for x in range(101) if x ** 2 > 3] |
1 | ## python -mtimeit -s'xs=range(10)' 'map(hex, xs)' |
1 | ## python -mtimeit -s'i=[1000,2000,3000]' 'j=[10,20,30]' '[m + n for m, n in zip(i ,j)]' |