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


Groups > comp.lang.python > #19675

Re: 'class' named tuple

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'attributes': 0.05; "subject:' ": 0.15; 'cc:addr:python-list': 0.15; 'subject:named': 0.16; 'thing?': 0.16; 'wrote:': 0.16; 'jan': 0.19; 'cheers,': 0.20; 'trying': 0.20; 'cc:no real name:2**0': 0.21; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'assigning': 0.23; 'index': 0.24; 'cc:2**0': 0.25; 'pm,': 0.26; 'message-id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'tue,': 0.32; 'object': 0.33; 'there': 0.33; 'received:209.85.212': 0.34; 'but': 0.37; 'received:google.com': 0.37; 'using': 0.37; 'received:209.85': 0.38; 'received:209': 0.39; '31,': 0.64; 'emmanuel': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=bOyRZmLc/FksIbTqdvAopsSezfNOzFGDat3RXCtLvDg=; b=dxAaLjdeV3wFWWnt/r8kMjc4zn9k5JYnO4b68f8SwqMqpIBNbArNnl06R0qn5lSTUz tjb2AUvSPNEpLQzkFhVI5g0kl9DfjkZTGskUJV08DpiGMFkRUn3Yr7oDqUp3l8br6jSP VFsEJi29Nfampi7uqPWWwCmLGpsfCM6jK2aIA=
MIME-Version 1.0
In-Reply-To <CACB6ZmC0JV6bY_t96KUggChb0F=pKArWKg4+hGc5Q9i1KvsO=Q@mail.gmail.com>
References <CACB6ZmC0JV6bY_t96KUggChb0F=pKArWKg4+hGc5Q9i1KvsO=Q@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 31 Jan 2012 18:15:09 -0700
Subject Re: 'class' named tuple
To Emmanuel Mayssat <emayssat@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5278.1328058940.27778.python-list@python.org> (permalink)
Lines 10
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328058940 news.xs4all.nl 6908 [2001:888:2000:d::a6]:55932
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19675

Show key headers only | 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