Steve Holden wrote:
>> Wait, I just might be an idiot. Is it not even necessary for me to
>> call Character's __init__ method? Fighter will inherit it
>> automatically and call it when a Fighter object is created, right?
>>
> By Jove, he's got it!
But I was thinking...even though there are bett
Bruno Desthuilliers wrote:
> John Salerno a écrit :
>> Peter Otten wrote:
>>
>>> You may need a no-op implementation of fix_attributes() in the Character
>>> class.
>>
>>
>> What does that mean? Is that in case I use Character directly to
>> create an object?
>
> Most propbably it can be useful f
At Wednesday 8/11/2006 22:35, Ben Finney wrote:
class Character(object):
stat_keys = ['strength', 'dexterity', 'intelligence']
def __init__(self, name, stats):
self.name = name
self.health = 10
self.stats = {}
for (key, value) i
John Salerno <[EMAIL PROTECTED]> writes:
> Ok, back to my so-called "game." I'm just curious if I've
> implemented the subclasses properly, because it seems like an awful
> lot of repetition with the parameters. And again, if I want to add a
> new attribute later, I'd have to change a lot of thing
John Salerno a écrit :
> Peter Otten wrote:
>
>> You may need a no-op implementation of fix_attributes() in the Character
>> class.
>
>
> What does that mean? Is that in case I use Character directly to create
> an object?
Most propbably it can be useful for other character classes that don't
John Salerno a écrit :
> Ok, back to my so-called "game." I'm just curious if I've implemented
> the subclasses properly, because it seems like an awful lot of
> repetition with the parameters. And again, if I want to add a new
> attribute later, I'd have to change a lot of things. I can't help
John Salerno wrote:
> John Salerno wrote:
>> Peter Otten wrote:
>>
>>> Try it: Fighter(...) will implicitly call Character.__init__(...).
>> Ok, I'm confused! :) I thought you had to explicity call a base class's
>> __init__ method? How is it doing this?
>
> Wait, I just might be an idiot. Is it
Peter Otten wrote:
> You may need a no-op implementation of fix_attributes() in the Character
> class.
What does that mean? Is that in case I use Character directly to create
an object? Would that just be a 'pass' statement?
--
http://mail.python.org/mailman/listinfo/python-list
John Salerno wrote:
> Peter Otten wrote:
>
>> Try it: Fighter(...) will implicitly call Character.__init__(...).
>
> Ok, I'm confused! :) I thought you had to explicity call a base class's
> __init__ method? How is it doing this?
Wait, I just might be an idiot. Is it not even necessary for me t
Peter Otten wrote:
> Try it: Fighter(...) will implicitly call Character.__init__(...).
Ok, I'm confused! :) I thought you had to explicity call a base class's
__init__ method? How is it doing this?
--
http://mail.python.org/mailman/listinfo/python-list
At Wednesday 8/11/2006 16:33, John Salerno wrote:
> class Character(object):
> def __init__(self, name, strength, dexterity, intelligence):
> self.name = name
> self.health = 10
> self.strength = strength
> self.dexterity = dexterity
> self.intelligenc
John Salerno wrote:
> Peter Otten wrote:
>
>> One way to avoid the repetition:
>>
>> class Character(object):
>> def __init__(self, name, strength, dexterity, intelligence):
>> self.name = name
>> self.health = 10
>> self.strength = strength
>> self.dexterity
Peter Otten wrote:
> One way to avoid the repetition:
>
> class Character(object):
> def __init__(self, name, strength, dexterity, intelligence):
> self.name = name
> self.health = 10
> self.strength = strength
> self.dexterity = dexterity
> self.intell
John Salerno wrote:
> Ok, back to my so-called "game." I'm just curious if I've implemented
> the subclasses properly, because it seems like an awful lot of
> repetition with the parameters. And again, if I want to add a new
> attribute later, I'd have to change a lot of things. I can't help but
>
John Salerno wrote:
> Ok, back to my so-called "game." I'm just curious if I've implemented
> the subclasses properly, because it seems like an awful lot of
> repetition with the parameters. And again, if I want to add a new
> attribute later, I'd have to change a lot of things. I can't help but
Ok, back to my so-called "game." I'm just curious if I've implemented
the subclasses properly, because it seems like an awful lot of
repetition with the parameters. And again, if I want to add a new
attribute later, I'd have to change a lot of things. I can't help but
get the feeling that I'm d
16 matches
Mail list logo