This is a bit cleaner (or at least more interesting) than Ruby's `(1..4).map {|x| x*2 }.filter {|x| x > 2}` I suppose. (Weird to me that range(1, 5) in Python does not include 5, as (1..5) does in Ruby.)
Python also has map/filter with lambdas, but list comprehension syntax is cleaner in the usual cases. Two sides of a similar coin (though Python's map/filter are lazily evaluated, which is neat, I don't remember if Ruby's is but I think it's eager?)
Excellent. You help me understand quickly!!!
I must say, you're great at explaining these hard to grasp concepts. Great stuff!
This is a bit cleaner (or at least more interesting) than Ruby's `(1..4).map {|x| x*2 }.filter {|x| x > 2}` I suppose.
(Weird to me that range(1, 5) in Python does not include 5, as (1..5) does in Ruby.)
The common use case in range is iterating through something zero indexed, so: range(len(list)) goes from 0 to len-1
Python also has map/filter with lambdas, but list comprehension syntax is cleaner in the usual cases. Two sides of a similar coin (though Python's map/filter are lazily evaluated, which is neat, I don't remember if Ruby's is but I think it's eager?)
@@KrisJordan in Ruby you have to be specific if you want lazy evaluation. Usually it's not something thought about though.
Mr. Jordan, gotta say thatI love the vids! Feet reveal at 2k?