Prepackaged function args

2009-05-18 Thread boblat...@googlemail.com
Hello group, suppose I've got a function f() that takes N parameters, and a list (or tuple) arg[] with N elements that I'd like to pass as parameters. The straightforward function call looks like this: result = f(arg[0], arg[1], ..., arg[N-1]) Is there a less verbose way of accomlishing this? T

How to convert a list of strings to a tuple of floats?

2009-05-18 Thread boblat...@googlemail.com
Hello group, this is the conversion I'm looking for: ['1.1', '2.2', '3.3'] -> (1.1, 2.2, 3.3) Currently I'm "disassembling" the list by hand, like this: fields = line.split('; ') for x in range(len(fields)): fields[x] = float(fields[x]) ftuple = tuple(fields) Of course it w