[BangPypers] Favorite tips/techniques

Gopalakrishnan Subramani gopalakrishnan.subramani at gmail.com
Tue Sep 10 12:15:45 CEST 2013


Not all keys in the dictionary can be expressed as attributes. Attributes
has to follow the naming conventions.

I had problems  with user generated 'keys', JSON supported keys.






On Tue, Sep 10, 2013 at 2:41 PM, Mandar Vaze / मंदार वझे <
mandarvaze at gmail.com> wrote:

> Both Shabda and Nouful used the term "prefer"
> Is there a "best practice" ?
>
>
> http://stackoverflow.com/questions/4984647/accessing-dict-keys-like-an-attribute-in-python
>
> This guy asked for "pitfalls and caveats" - but no one seem to have
> addressed the "question" (There are several answers about "How to do it
> better")
>
> -Mandar
>
>
> On Tue, Sep 10, 2013 at 10:00 AM, Noufal Ibrahim <noufal at nibrahim.net.in
> >wrote:
>
> > 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
> > _______________________________________________
> > BangPypers mailing list
> > BangPypers at python.org
> > https://mail.python.org/mailman/listinfo/bangpypers
> >
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list