[BangPypers] Favorite tips/techniques

Noufal Ibrahim noufal at nibrahim.net.in
Tue Sep 10 06:30:37 CEST 2013


Shabda Raaj <shabda at agiliq.com> writes:

> http://code.activestate.com/recipes/52308-the-simple-but-handy-collector-of-a-bunch-of-named/
>
> With api responses after you have parsed the json, you start doing things
> like:
>
> api_response["attribute"]
>
> I would much prefer to do
>
> api_response.attribute

I generally like to use attributes instead of keys. One additional
advantage is that I can, if necessary, later convert the attribute into
a property that does more than just return a value.

[...]


-- 
Cordially,
Noufal
http://nibrahim.net.in


More information about the BangPypers mailing list