On Mon, 19 Dec 2011 18:04:15 -0800, Gnarlodious wrote: > What is the best way to operate on a tuple of values transforming them > against a tuple of operations? Result can be a list or tuple:
Create a list of functions:
ops = [lambda obj: obj,
"<span class='H'>{}</span>".format,
bool,
bool,
lambda obj: obj,
bool,
escape,
]
then use zip to pair them up with their arguments:
results = [f(x) for f,x in zip(ops, tup)]
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
