5 ms·
Python's "and" is equivalent to Ruby's "&&". Python has no equivalent to Ruby's "and" which is copied from Perl. In other words, Ruby has only one way to expr
by graywh 14y ago
Python's "and" is equivalent to Ruby's "&&". Python has no equivalent to Ruby's "and" which is copied from Perl. In other words, Ruby has only one way to express a boolean "and", "&&", but the existence of the flow-control modifier "and" trips up new users constantly. Which is why this topic lands on HN regularly.
- jfb 14y agoWhich is, from the Python mindset, a flaw in Ruby the language.
- cheald 14y agoAnd from a Ruby mindset, is a limitation in the Python language. :)
- jfb 14y agoYep. There's no right answer. I say, a pox on both their houses. (and predicate-1? predicate-2?)
- georgemcbay 14y agoAs someone currently dealing with a lot of Java code, I love that Java only has && and not "and", it allows Java programmers to construct simple, easy-to-understand constructs like this: if (true && false == true) { return new BooleanFactory(true); } else { return new BooleanFactory(false); }