Op 2005-12-06, [EMAIL PROTECTED] schreef <[EMAIL PROTECTED]>: > > Antoon Pardon wrote: >> Op 2005-12-06, [EMAIL PROTECTED] schreef <[EMAIL PROTECTED]>: >> > >> > Paul Rubin wrote: >> >> > Why use temporary variables when all you have to do is make your >> >> > expressions three lines long to avoid "polluting the namespace"? >> >> >> >> Indeed. I'd much rather say >> >> >> >> x = a + b + (c * d) + e >> >> >> >> than >> >> >> >> temp1 = a + b >> >> temp2 = c * d >> >> temp3 = temp1 + temp2 >> >> x = temp3 + e >> >> >> >> I don't understand why the critics of lambda don't understand that >> >> having to use so many temp variables, for either numbers or functions, >> >> can work against both concision and clarity. >> > >> > For some people, the second form is clearer. >> >> But there is no suggestion that this should be the obligatory form. > > I think there is, for python. Not that I agree with it. The language > doesn't prevent you from using the short one-liner style but the idioms > prefer the line by line(and one single op/action per line) style. >
That is odd, because I remember very well that at one time I was using such a line by line approach and it was almost regarded as a bug. The only difference of relevance between the above was that the last line was a call, instead of an assignment. The prime argument for why such a style was not done, was that it kept all kinds of references to temporary results active, which meant they couldn't be recycled by the garbage collector. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list