Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107746
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Pythonic style |
| Date | 2016-04-28 13:23 +1000 |
| Message-ID | <mailman.164.1461813821.32212.python-list@python.org> (permalink) |
| References | (1 earlier) <CALwzidn0SN5yax3bfmTPDTxBvfr+bnVNzeUe3dZYrS9ji2WCtw@mail.gmail.com> <572166FA.3020108@icloud.com> <85y47yjxj5.fsf_-_@benfinney.id.au> <57217E73.9040907@icloud.com> <85twimju18.fsf@benfinney.id.au> |
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