Migration from python to ruby is problematic because ruby lacks certain features.
Most important python advantage is chained comparison
We must wrap every comparison like described below.
puts "yes" if 1<2<3<4 class Fixnum def <(a) ((self<=>a)==-1)&&a end end class FalseClass def <(a) false end end
#6 [ruby-core:75177] Updated by Stefan Schüßler 3 months ago
Yukihiro Matsumoto wrote:
I don't think changing "
1 < b < 4" to "
1 < b && b < 4" is that hard task.
1 < b && b < 4 is not hard. But doesn't
1 < b < 4 look intriguing? It's so clean!
I would also expect a slight difference, namely that
1 < b < 4 evaluates
b once and
1 < b && b < 4 evaluates