From: Sebastian Hungerecker Date: 2009-04-18T00:25:37+09:00 Subject: Re: simple (?) question regarding the "&&" and "and" operators Philip Müller wrote: > a and b > > => b > > ? > > I would expect it to return true. The pseudo-code for and basically looks like this: a and b = if a: b else: a This means that if a or b evaluate to a something that counts as false, then the whole expression will also evaluate to something that counts as false. And if neither of them do, then the whole expression will evaluate to something that counts as true. So for if-conditions etc. the expression will work as expected. The reason that it returns a/b and not true/false is that a) there are very few cases where you need the value to be an explicit boolean b) there are quite a few cases where returning a/b is more meaningful and/or useful than just returning true/false (though that's more the case for "or" than "end". Example: foo = ARGV[0] or default_value). HTH, Sebastian