On Mon, 05 Dec 2005 19:31:46 -0800, bonono wrote: > > 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.
If anybody needs to break an expression with three short terms up into individual temporary variables in order to understand it, then I suggest they should re-think their career choice as a programmer. Having said that, there are some expressions which are sufficiently complex that they do need to be broken up into smaller pieces. In which case, you *should* be naming the pieces, and not trying to shoe-horn them into a one-liner. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list