From: Eivind Eklund Date: 2007-06-22T20:23:34+09:00 Subject: Re: avoiding nil.methodcalls short and cheap On 6/22/07, Michal Suchanek wrote: > I would avoid code that relies on logical operators to preserve values. > That is any code that uses logical operators and would break if you > put !!() around the expression is quite dodgy in my book. And I would strongly disagree with this. Returning the value of the true expression is defined behavior, and it allows for considerable simplification of code. Having simpler code means that you have less chance of errors and spend less time when reading the code. To my mind, dodgy code is code that is difficult to understand or increase chance of errors, ie, the opposite of code that does appropriate use of the preservation of values in logical operators. Not that I'm particularly happy with any of the cases above - the closest to "good" I found was textvalue = (text = tag.get_text and text.get_value) Eivind.