From: Joel VanderWerf Date: 2004-06-13T05:05:59+09:00 Subject: Re: Appropriate use of camelCase Ryan Paul wrote: > Part of what makes ruby powerful is the fact that it doesnt sacrifice > power and brevity to increase readability. Ruby is downright unintuitive > in some places, with extremely rewarding consequences. > > For instance, compare ruby blocks to python list comprehensions: > > lst.reject {|x| not x.upcase.include? n.upcase } > > vs. > > [x for x in lst if n.upper in x.upper] Unintuitive? It might help to avoid the double negative... lst = %w{ foo BaR baZ foobar } n = "bar" # original p lst.reject {|x| not x.upcase.include? n.upcase } # no double negative p lst.select {|x| x.upcase.include? n.upcase } # even better :) p lst.grep(/#{n}/i) To know ruby is to love it.