Wow, that is so elegant. Python is awesome.
-- Gnarlie
--
http://mail.python.org/mailman/listinfo/python-list
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,
"{}".format,
bool,
bool,
On 12/19/11 20:04, 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:
tup=(35, '34', 0, 1, 31, 0, '既濟')
from cgi import escape
[tup[0], " class='H'>{}".format(tup[1]), bool(tup[2]),
bool(tup[3])
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:
tup=(35, '34', 0, 1, 31, 0, '既濟')
from cgi import escape
[tup[0], "{}".format(tup[1]), bool(tup[2]),
bool(tup[3]), tup[4], bool(tup[5]), escape(tup[6])]
-> [35,