Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #107738

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

From Christopher Reimer <christopher_reimer@icloud.com>
Newsgroups comp.lang.python
Subject Re: Differences between Class(Object) and Class(Dict) for dictionary usage?
Date 2016-04-27 18:21 -0700
Message-ID <mailman.156.1461806474.32212.python-list@python.org> (permalink)
References <5720357B.4060009@icloud.com> <57204EA6.7060007@stoneleaf.us> <CALwzidnr_O3m3=7RGUD1pu0Op93pZSLXKOMjHbecKRBeYn_30A@mail.gmail.com> <57216581.1070603@icloud.com>

Show all headers | View raw


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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Differences between Class(Object) and Class(Dict) for dictionary usage? Christopher Reimer <christopher_reimer@icloud.com> - 2016-04-27 18:21 -0700

csiph-web