Differences between Class(Object) and Class(Dict) for dictionary usage?

Christopher Reimer christopher_reimer at icloud.com
Wed Apr 27 21:21:05 EDT 2016


On 4/27/2016 7:24 AM, Ian Kelly wrote:
> Some other great questions to ask yourself are "do I really want 
> len(my_object) to return the number of items in this dict" and "do I 
> really want list(my_object) to return all the keys in this dict"? If 
> the answer to all those is yes, then it's probably fair to say that 
> your object is-a dict and should be modeled as such.

These questions are more useful for me to consider. For my chess piece 
base class, the answer is no.

Thank you,

Chris R.



More information about the Python-list mailing list