assigning values in __init__

John Salerno johnjsal at NOSPAMgmail.com
Wed Nov 8 16:55:57 CET 2006


Ben Finney wrote:
> John Salerno <johnjsal at NOSPAMgmail.com> writes:
> 
>> But I do like Steve's suggestion that it's better to be explicit
>> about each attribute, instead of just accepting a list of numbers
>> (but I can't help but feel that for some reason this is better,
>> because it's more general).
> 
> If you pass a *mapping* of the "I-might-want-to-add-more-in-the-future"
> values, then you get both explicit *and* expandable, without an
> arbitrary unneeded sequence.
> 

Do you mean by using the **kwargs parameter? If I do this, doesn't it 
mean that *anything* could be added though? Misspelled words and 
completely unrelated attributes as well?

Or does this matter as long as you are handling the processing yourself 
internally and not allowing users access to the Character class?



More information about the Python-list mailing list