'class' named tuple

Ian Kelly ian.g.kelly at gmail.com
Wed Feb 1 02:15:09 CET 2012


On Tue, Jan 31, 2012 at 5:54 PM, Emmanuel Mayssat <emayssat at 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



More information about the Python-list mailing list