optional argument to a subclass of a class

Alex Hall mehgcap at gmail.com
Fri May 21 18:27:33 EDT 2010


On 5/21/10, Chris Rebert <clp2 at rebertia.com> wrote:
> On Fri, May 21, 2010 at 1:09 PM, Alex Hall <mehgcap at gmail.com> wrote:
>> On 5/21/10, Ethan Furman <ethan at stoneleaf.us> wrote:
>>> Alex Hall wrote:
>>>> On 5/20/10, alex23 <wuwei23 at gmail.com> wrote:
>>>> I have since updated each ship's
>>>> __init__ to accept all the arguments that Craft accepts so that I can
>>>> support all optional arguments,
>>>
>>> Ick.  Now you'll have to change several things if you make one change to
>>> the Craft class.  Better to do it this way:
>>>
>>> [borrowing Peter's example]
>>>
>>> class Craft(object):
>> Curious: I do not pass Craft this "object" keyword and I have no
>> problems. What is it for? Just a convention, something like self being
>> called self?
>
> It causes the class to be "new-style". See
> http://docs.python.org/reference/datamodel.html#new-style-and-classic-classes
Oh, I see. Thanks.
>
> Cheers,
> Chris
> --
> http://blog.rebertia.com
>


-- 
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