Hacker News new | ask | show | jobs
by graywh 4854 days 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.
1 comments

Which is, from the Python mindset, a flaw in Ruby the language.
And from a Ruby mindset, is a limitation in the Python language. :)
Yep. There's no right answer. I say, a pox on both their houses.

  (and predicate-1? predicate-2?)
As 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);
  }