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


Groups > comp.lang.python > #107745

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

From Christopher Reimer <christopher_reimer@icloud.com>
Newsgroups comp.lang.python
Subject Re: Pythonic style (was: Differences between Class(Object) and Class(Dict) for dictionary usage?)
Date 2016-04-27 20:07 -0700
Message-ID <mailman.163.1461812854.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>

Show all headers | View raw


On 4/27/2016 7:07 PM, Ben Finney wrote:
> I would say the latter is more Pythonic, because it:
>
> * Better conveys the intention (“set the value of the ‘self.key’
>    attribute”).
>
> * Uses the built-in mechanisms of Python (don't invoke magic attributes,
>    instead use the system that makes use of them behind the scenes).
>
> * Expresses that intention more concisely (fewer terms).
>
> * Expresses that intention more clearly (less syntactic noise).

In short,  my original code before I turned it into a separate 
dictionary. *sigh*

Thank you,

Chris R.

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


Thread

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

csiph-web