Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107746
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Ben Finney <ben+python@benfinney.id.au> |
| Newsgroups | comp.lang.python |
| Subject | Re: Pythonic style |
| Date | Thu, 28 Apr 2016 13:23:31 +1000 |
| Lines | 23 |
| Message-ID | <mailman.164.1461813821.32212.python-list@python.org> (permalink) |
| References | <5720357B.4060009@icloud.com> <CALwzidn0SN5yax3bfmTPDTxBvfr+bnVNzeUe3dZYrS9ji2WCtw@mail.gmail.com> <572166FA.3020108@icloud.com> <85y47yjxj5.fsf_-_@benfinney.id.au> <57217E73.9040907@icloud.com> <85twimju18.fsf@benfinney.id.au> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | news.uni-berlin.de ObFAbC2uHm/bndsbtbUG9AUThEAhAumSIgtnJuXT/UNQ== |
| Cancel-Lock | sha1:KrqOToWkAECN7SHe26lrfvEcHwM= |
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; '*not*': 0.07; 'attributes': 0.07; 'purpose.': 0.07; 'instance.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'explicitly': 0.15; 'dictionary.': 0.16; 'distinct': 0.16; 'mapping,': 0.16; 'rather,': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'made.': 0.22; 'object.': 0.22; 'discussion': 0.24; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'points': 0.27; 'separate': 0.27; 'object,': 0.27; 'dictionary': 0.29; 'short,': 0.29; 'code': 0.30; 'standards': 0.30; 'point': 0.33; 'should': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'say': 0.37; 'received:org': 0.37; 'no,': 0.38; 'turned': 0.38; 'to:addr:python.org': 0.40; 'more': 0.63; 'talking': 0.67; 'home': 0.67; 'choose': 0.68; '_o__)': 0.84; 'misses': 0.84; 'received:125': 0.84; '\xe2\x80\x9cthe': 0.93 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| X-Gmane-NNTP-Posting-Host | jigong.madmonks.org |
| X-Public-Key-ID | 0xAC128405 |
| X-Public-Key-Fingerprint | 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 |
| X-Public-Key-URL | http://www.benfinney.id.au/contact/bfinney-pubkey.asc |
| X-Post-From | Ben Finney <bignose+hates-spam@benfinney.id.au> |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
| 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 | <85twimju18.fsf@benfinney.id.au> |
| X-Mailman-Original-References | <5720357B.4060009@icloud.com> <CALwzidn0SN5yax3bfmTPDTxBvfr+bnVNzeUe3dZYrS9ji2WCtw@mail.gmail.com> <572166FA.3020108@icloud.com> <85y47yjxj5.fsf_-_@benfinney.id.au> <57217E73.9040907@icloud.com> |
| Xref | csiph.com comp.lang.python:107746 |
Show key headers only | View raw
Christopher Reimer <christopher_reimer@icloud.com> writes: > In short, my original code before I turned it into a separate > dictionary. *sigh* No, I think that misses the points that were being made. The discussion you're talking about was *not* to say “attribute access is better than dictionary access”, or vice versa. Each is good for its purpose. Rather, the discussion was to drive home the point that in Python those are *two distinct concepts*, and you need to not conflate them. If you want items in a mapping, explicitly use a Python ‘dict’ instance. If you want attributes that describe an object, explicitly use attributes of that object. Deliberately choose which one makes more sense. -- \ “The double standard that exempts religious activities from | `\ almost all standards of accountability should be dismantled | _o__) once and for all.” —Daniel Dennett, 2010-01-12 | Ben Finney
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Pythonic style Ben Finney <ben+python@benfinney.id.au> - 2016-04-28 13:23 +1000 Re: Pythonic style Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-04-28 15:31 +1000
csiph-web