kj wrote:
... I want to document a function that takes a dictionary as argument,
and this dictionary is expected to have 5 keys. When the number of mandatory
> arguments gets above 4, I find that it's too difficult to remember
> their order, so I resort to using a dictionary as the single argument.
Do you know you can call a function with mandatory args as keyword args?
def f(value, scale, metrics, color, age, validity):
print 'f', value, scale, metrics, color, age, validity
...
f(23, age=6, scale=2.5, metrics=2, validity='strong', color='red')
You can even use your arg dictionaries in transitional code:
call_dict = {'value': 23, 'age': 6, 'scale': 2.5, 'metrics': 2,
'validity': 'strong', 'color': 'red'}
f(**call_dict)
--Scott David Daniels
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list