[Tutor] Question about large numbers of arguments
bgailer at alum.rpi.edu
Wed Apr 5 01:30:37 CEST 2006
Dana Robinson wrote:
> 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.
> Create an options class to pass the options around.
IMHO the above or a dictionary.
> 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.
> Dana Robinson
> Tutor maillist - Tutor at python.org
More information about the Tutor