[BangPypers] [JOBS] Django Developer

2014-05-23 Thread Shuhaib Shariff
DoubleSpring seeks passionate PYTHON / DJANGO developers with experience in building or contributing to Open Source projects. We are constantly rolling out new products so the right individual would be able to write clean code and work in a fast pace environment. We highly value native ability, pa

[BangPypers] Two Scoops of Django at Bangpypers!

2014-05-23 Thread Haris Ibrahim K. V.
Ladies and Gentlemen, The third Saturday of every month is like an amazing party that I look forward to every month now. Almost 50 of us have been consistently coming to the meetup since the past 5 months. One of the things that I love about Bangalore. :) This month's meetup had a special moment.

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

2014-05-23 Thread Mandar Vaze / मंदार वझे
On Fri, May 23, 2014 at 5:26 PM, Navin Kabra wrote: > "Mandar Vaze / मंदार वझे" writes: > > > Code 1: > > ... > > return dict(fname=fname, lname=lname, saluation=salutation, > > gender=gender, addr1=addr1, addr2=addr2, > > city=city, state=state, country=country) > > First of a

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

2014-05-23 Thread Navin Kabra
"Mandar Vaze / मंदार वझे" writes: > Code 1: > ... > return dict(fname=fname, lname=lname, saluation=salutation, > gender=gender, addr1=addr1, addr2=addr2, > city=city, state=state, country=country) First of all, both functions are returning a single value, a single dict. So the

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

2014-05-23 Thread Noufal Ibrahim KV
On Fri, May 23 2014, kracekumar ramaraju wrote: > Rohit > > Probably ease of writing may be right here. It's also more future proof. An attribute can be replaced by a property which implements access controls and other things without breaking API contracts. It's harder to do that while subscript

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

2014-05-23 Thread kracekumar ramaraju
Rohit Probably ease of writing may be right here. On Fri, May 23, 2014 at 1:46 PM, Rohit Chormale wrote: > R u sure @ 'ease of access' or is it 'ease of writing'? > > > On Fri, May 23, 2014 at 1:43 PM, kracekumar ramaraju < > kracethekingma...@gmail.com> wrote: > > > Yes. Attributes are fixed.

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

2014-05-23 Thread Rohit Chormale
R u sure @ 'ease of access' or is it 'ease of writing'? On Fri, May 23, 2014 at 1:43 PM, kracekumar ramaraju < kracethekingma...@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,

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

2014-05-23 Thread kracekumar ramaraju
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 wrote: > On Fri, May 23 2014, kracekumar ramaraju wrote: > > > You can use namedtuple. > > > > from collections import na

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

2014-05-23 Thread Noufal Ibrahim KV
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?

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

2014-05-23 Thread kracekumar ramaraju
You can use namedtuple. from collections import namedtuple Person = namedtuple('Person', ['foo', 'bar', 'baz']) p = Person(foo='foo', bar='bar', baz='baz') print p.foo 'foo' On Fri, May 23, 2014 at 1:23 PM, Noufal Ibrahim KV wrote: > On Fri, May 23 2014, Rohit Chormale wrote: > > > How is it

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

2014-05-23 Thread Noufal Ibrahim KV
On Fri, May 23 2014, Mandar Vaze / मंदार वझे wrote: > Currently I came across the code that returned 9 values (return statement > spanned 5 lines due to pep8 limitation of 79 characters per line) > > The function returns various values that are used by the template to render > HTML > > To give you

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

2014-05-23 Thread Noufal Ibrahim KV
On Fri, May 23 2014, Rohit Chormale wrote: > How is it if you use DataContainer class & set attributes of that class. > Something like, > > class Data(object): > > def __init__(self, **kwargs): > object.__setattr__(self, 'attribs', kwargs) > > def __getattr__(self, item): > if

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

2014-05-23 Thread Rohit Chormale
How is it if you use DataContainer class & set attributes of that class. Something like, class Data(object): def __init__(self, **kwargs): object.__setattr__(self, 'attribs', kwargs) def __getattr__(self, item): if item in self.attribs: return self.attribs[item]