optional argument to a subclass of a class

Terry Reedy tjreedy at udel.edu
Fri May 21 13:52:16 EDT 2010


On 5/20/2010 10:56 PM, Alex Hall wrote:

A couple of style comments for you to consider.

> class Craft():
>   def __init__(self,
>   name,
>   isAircraft=False,
>   id=helpers.id(),
>   hits=0,
>   weapons=[]):

Not indenting lines after def makes the code harder to read for me, and, 
I expect, many others here who use indentation as a cue. If you want one 
param per line, give them extra indents if you want.

>    self.name=name
>    self.id=id
>    self.hits=hits
>    self.weapons=weapons
>    self.isAircraft=isAircraft
>   #end def
> #end class

#end markers are fine for private code but are distracting noise to me, 
and, I expect, other experienced Python coders.

Terry Jan Reedy




More information about the Python-list mailing list