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 ID attribute. What i actually tried to do is get the field names and values at run-time like below,
mark = [Grade._make(input().split()).MARKS] print(mark) Without knowing the internals, i tried setting it directly first. The above code works well getting both ID and MARKS as inputs and creates a list of MARKS only if I loop through that same line. Thanks for all the help. Much appreciated. Regards, Vinu On Fri, Oct 19, 2018 at 3:48 AM Jason Friedman <jsf80...@gmail.com> wrote: > > > > 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 may be of interest to you: > https://www.python.org/dev/peps/pep-0557/. > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list