optional argument to a subclass of a class

Alex Hall mehgcap at gmail.com
Fri May 21 14:08:39 EDT 2010


On 5/21/10, Terry Reedy <tjreedy at udel.edu> wrote:
> 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.
Good point, I had not considered that; Python's relyance on
indentation made me think that indenting past the level of the class
would cause problems.
>
>>    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.
I will try to remember to remove them for posting, but I find them
immensely helpful; using a screen reader, and so not being able to
look at code and see the indentation, means that I have to have a way
to tell myself where things end, much like braces in other languages.
When I post here I will try to remove them, but for code I zip and put
on my website they have to stay since I rely on them and the zip is
just what I am working on at the time, plus there are a lot of those
comments to remove from an entire project.
>
> Terry Jan Reedy
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehgcap at gmail.com; http://www.facebook.com/mehgcap



More information about the Python-list mailing list