"Deron Meranda" <[EMAIL PROTECTED]> writes:
> do_transform = some_rare_condition
> for item in some_sequence:
> if do_transform:
> item2 = transform_function(item)
> else:
> item2 = item
> ..... # more stuff
This might be a little more direct:
from itertools import imap
if some_rare_condition:
mapped_sequence = imap(transform_function, some_sequence)
else:
mapped_sequence = some_sequence
for item in mapped_sequence:
# more stuff
I agree that an identity function would be useful. I think I
suggested it a long time ago and didn't get much interest.
--
http://mail.python.org/mailman/listinfo/python-list