Pythonic style (was: Differences between Class(Object) and Class(Dict) for dictionary usage?)
Christopher Reimer
christopher_reimer at icloud.com
Wed Apr 27 23:07:31 EDT 2016
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.
More information about the Python-list
mailing list