define
Steven Taschuk
staschuk at telusplanet.net
Thu May 8 12:42:09 EDT 2003
Quoth Turhan Ozen:
> I have a long list of parameters. I want to keep them in an array in
> order to pass them to functions. But I want to use the name of each
> parameter in the formulas to make them easy to read. I can use x[index]
> in the formulas. I am trying to have another name for each x[index]. If
> I do anything to this secondary reference, the same is done to the
> corresponding x[index].
How about this?
class Parameters(object):
pass
def foo(params):
print params.y
p = Parameters()
p.x = 1
p.y = 2
foo(p)
I don't see above any statement that you need the parameters in a
specific order, so I don't see the purpose of using a list.
But then I'm not sure why you want to pass all the parameters as a
single object either... is that just for typing convenience?
--
Steven Taschuk staschuk at telusplanet.net
"I'm always serious, never more so than when I'm being flippant."
-- _Look to Windward_, Iain M. Banks
More information about the Python-list
mailing list