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?

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Christopher Reimer <christopher_reimer@icloud.com>
Newsgroups comp.lang.python
Subject Re: Differences between Class(Object) and Class(Dict) for dictionary usage?
Date Wed, 27 Apr 2016 18:21:05 -0700
Lines 13
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>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de c/62q/EPWZJY37D62fe/xAuX9jJiGQQp81WxZb3sJHQQ==
Return-Path <christopher_reimer@icloud.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.089
X-Spam-Evidence '*H*': 0.82; '*S*': 0.00; 'dict': 0.09; 'subject:Object': 0.09; 'subject: \n ': 0.15; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:between': 0.16; 'subject:usage': 0.16; 'wrote:': 0.16; 'class,': 0.22; 'keys': 0.22; 'am,': 0.23; 'header:User-Agent:1': 0.26; 'chris': 0.26; 'received:17': 0.27; '"do': 0.29; 'such.': 0.29; 'probably': 0.31; 'received:10.0.0': 0.32; 'subject:) ': 0.32; 'useful': 0.33; 'received:10.0': 0.34; 'should': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'really': 0.37; 'say': 0.37; 'thank': 0.38; 'to:addr:python.org': 0.40; 'some': 0.40; 'questions': 0.40; 'header:MIME-version:1': 0.60; 'your': 0.60; 'no.': 0.62; 'charset:windows-1252': 0.62; 'more': 0.63; 'great': 0.63; 'yourself': 0.73; 'header:In-reply-to:1': 0.84; 'subject:Class': 0.91
X-Proofpoint-Virus-Version vendor=fsecure engine=2.50.10432:,, definitions=2016-04-27_14:,, signatures=0
X-Proofpoint-Spam-Details rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1510270003 definitions=main-1604280016
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2
In-reply-to <CALwzidnr_O3m3=7RGUD1pu0Op93pZSLXKOMjHbecKRBeYn_30A@mail.gmail.com>
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=4d515a; t=1461806466; bh=6br0M15PZItJ4fIGiZZBTUAF3Y/4DbyqT3kKxXcqRi4=; h=Subject:To:From:Message-id:Date:MIME-version:Content-type; b=NtLdoHie8cum+1nTwRjCtBp0rqK/HHeUEW5UguNyGg8c5XBsBkM6U3EFNz4KEDsOp JiAYpT4/m0zdxU2J+CX506iEnc82YKwefCbmLz3Wai8cOcZroXoYUcVolFEesoPcZY SYZNH+XN9LjhfF/2RfDbJlYu3fesKmWp6TW+yc4LfnDD5Co7ej/937PEJP3ah1ZT6I DEW5X+g1RA9CKjA9tUIYp8ZmgAsjGfG7T4Ex47p3/q8HGeip10NfNCg74KVVyL+3s8 caYeu4d4TPQ1jWs1ooWY3dXQ1DE51qU+VvHvwB84oMikvc/Ew28Lh+CsjZTXWKEeCL KgYttPPOpBtBg==
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <57216581.1070603@icloud.com>
X-Mailman-Original-References <5720357B.4060009@icloud.com> <57204EA6.7060007@stoneleaf.us> <CALwzidnr_O3m3=7RGUD1pu0Op93pZSLXKOMjHbecKRBeYn_30A@mail.gmail.com>
Xref csiph.com comp.lang.python:107738

Show key headers only | 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