Simple pychecker question

Michael Gilfix mgilfix at eecs.tufts.edu
Sun Jun 9 09:45:25 EDT 2002


On Sun, Jun 09 @ 03:04, Peter Hansen wrote:
> For a routine named and structured like this:
> 
>   def transmit(data, timeout=1.0):
> 
> which of the following would you say was the better call
> in some code that might be remote from that definition
> above?
> 
> 1.  transmit('this is a string', 5)
> 
> 2.  transmit('this is a string', timeout=5)
> 
> My point: named arguments can increase readability and 
> maintainability.  That's not superfluous, to me.

  I tend to opt for the hidden defaults. Sometimes, I want to provide
the users of my classes the option of intializing the class with data,
or setting the data later (as in the case of a graph). So something
like:

   def __init__ (self, data=None)
   def set_data (self, data)

  is pretty useful for me. My version of pychecker complained, which
got me wondering. But if Neil says it's fixed, then I'm sure it is :)

                       -- Mike

-- 
Michael Gilfix
mgilfix at eecs.tufts.edu

For my gpg public key:
http://www.eecs.tufts.edu/~mgilfix/contact.html





More information about the Python-list mailing list