[BangPypers] Multiple return values from a function : Where to draw the line ?

kracekumar ramaraju kracethekingmaker at gmail.com
Fri May 23 10:26:31 CEST 2014


Rohit

 Probably ease of writing may be right here.


On Fri, May 23, 2014 at 1:46 PM, Rohit Chormale <rohitchormale at gmail.com>wrote:

> R u sure @ 'ease of access' or is it 'ease of writing'?
>
>
> On Fri, May 23, 2014 at 1:43 PM, kracekumar ramaraju <
> kracethekingmaker at gmail.com> wrote:
>
> > Yes. Attributes are fixed. The advantage over dictionary is ease of
> access
> > like p.foo rather than p['foo'] or p.get('foo').
> >
> >
> > On Fri, May 23, 2014 at 1:34 PM, Noufal Ibrahim KV
> > <noufal at nibrahim.net.in>wrote:
> >
> > > On Fri, May 23 2014, kracekumar ramaraju wrote:
> > >
> > > > You can use namedtuple.
> > > >
> > > > from collections import namedtuple
> > > > Person = namedtuple('Person', ['foo', 'bar', 'baz'])
> > > > p = Person(foo='foo', bar='bar', baz='baz')
> > >
> > > [...]
> > >
> > > Much better although with namedtuple, the attributes are fixed aren't
> > > they? I don't use collections as much as I should.
> > >
> > >
> > > --
> > > Cordially,
> > > Noufal
> > > http://nibrahim.net.in
> > >
> >
> >
> >
> > --
> >
> > *Thanks & Regardskracekumar"Talk is cheap, show me the code" -- Linus
> > Torvaldshttp://kracekumar.com <http://kracekumar.com>*
> > _______________________________________________
> > 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
>



-- 

*Thanks & Regardskracekumar"Talk is cheap, show me the code" -- Linus
Torvaldshttp://kracekumar.com <http://kracekumar.com>*


More information about the BangPypers mailing list