Re: namedtuples anamoly

2018-10-19 Thread Vinodhini Balusamy
Thanks everyone for promptly answering my question. Answer to Gary's question, I haven't used named tuples and tried it. The way the tuple subclass getting created plus the property features i wasn't much aware of. But now i am very clear, how I set ID object and changed the interface to access I

Re: namedtuples anamoly

2018-10-18 Thread Jason Friedman
> > So now the real question is: What were you trying to accomplish with > the assignment? Tell us, and let's see if we can find a way to > accomplish yor goal without wrecking the internals of the Grade class. > > And depending on your answer to that question, the new Data Classes feature in 3.7

Re: namedtuples anamoly

2018-10-18 Thread Gary Herron
On 10/17/2018 11:13 PM, me.vi...@gmail.com wrote: Hi, I tried using namedtuples and just found a behaviour which I am not able to conclude as correct behaviour. from collections import namedtuple (n, categories) = (int(input()), input().split()) Grade = namedtuple('Grade', categories) Grade.

Re: namedtuples anamoly

2018-10-18 Thread Peter Otten
Vinodhini Balusamy wrote: > Hi, > > I tried using namedtuples and just found a behaviour which I am not able > to conclude as correct behaviour. > > from collections import namedtuple > > (n, categories) = (int(input()), input().split()) > Grade = namedtuple('Grade', categories) > Grade.ID = 1

namedtuples anamoly

2018-10-17 Thread Vinodhini Balusamy
Hi, I tried using namedtuples and just found a behaviour which I am not able to conclude as correct behaviour. from collections import namedtuple (n, categories) = (int(input()), input().split()) Grade = namedtuple('Grade', categories) Grade.ID = 1 #print(Grade.ID) ob = Grade(10, 50) print(ob.ID