Design: method in class or general function?

Leam Hall leamhall at gmail.com
Thu Sep 7 05:20:56 EDT 2017


OOP newbie on Python 2.6.

I create instances of Character class with an attribute dict of 
'skills'. The 'skills' dict has the name of a skill as the key and an 
int as a value. The code adds or modifies skills before outputting the 
Character.

Is it better design to have a Character.method that takes a 'skill' key 
and optional value or to have a general function that takes an instance, 
a dict, a key, and an optional value?





More information about the Python-list mailing list