[Tutor] Question about large numbers of arguments

Dana Robinson derobins at scs.uiuc.edu
Wed Apr 5 01:06:25 CEST 2006


Hello,

Suppose you have a situation where you have a large number of command-line
options that you will parse with getopt.  You want to keep track of these
as you move around in the code and do various things.

Is it more Pythonic to:

Have the functions take large numbers of parameters.

or

Create an options class to pass the options around.


I personally think the latter would look a lot cleaner once the number of
options got up to around a half dozen, but I usually see the "large number
of parameters" style in other people's code.  I suppose I can lessen some
of the noise by using Python's rules for argument defaults, but I think
that just adds to the confusion.

Thanks,

Dana Robinson


More information about the Tutor mailing list