On Sat, 17 Feb 2007 22:19:41 -0800, Raymond Hettinger wrote: > [Deron Meranda >>] I'm looking for something in >> Python which would act like an identity operator, or I-combinator: a >> do-nothing function. The best I know of is: (lambda x: x), but it is >> not ideal. > > File a feature request on SourceForge and assign to me. This has come > up a couple of times and would be trivial to implement in the operator > or functools modules.
I'm surprised. The Original Poster specified [quote] What python needs is something like a built-in "operator.identity" function, which acts like "lambda x:x", but which the byte compiler could recognize and completely optimize away so there is no function call overhead. [end quote] I would have guessed that optimizing the call away would require support from the compiler. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list