Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #19675

Re: 'class' named tuple

References <CACB6ZmC0JV6bY_t96KUggChb0F=pKArWKg4+hGc5Q9i1KvsO=Q@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2012-01-31 18:15 -0700
Subject Re: 'class' named tuple
Newsgroups comp.lang.python
Message-ID <mailman.5278.1328058940.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Jan 31, 2012 at 5:54 PM, Emmanuel Mayssat <emayssat@gmail.com> wrote:
> I have the following program.
> I am trying to have index the attributes of an object using __getitem__.
> Reading them this way works great, but assigning them a value doesn't
> Is there a way to do such a thing?

For assignment, use __setitem__.

Cheers,
Ian

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: 'class' named tuple Ian Kelly <ian.g.kelly@gmail.com> - 2012-01-31 18:15 -0700

csiph-web