Named tuples
Bryan
belred1 at yahoo.com
Thu Nov 18 00:04:16 EST 2004
Bengt Richter wrote:
> On Thu, 18 Nov 2004 02:57:23 GMT, Bryan <belred1 at yahoo.com> wrote:
> [...]
>
>>it should be possible to avoid a recusive problem:
>>
>>
>>>>>a = ('1', '2')
>>>>>a.__names__ = ('ONE', 'TWO')
>
> I guess you are working with a patched version of python?
>
> >>> a = ('1', '2')
> >>> a.__names__ = ('ONE', 'TWO')
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> TypeError: 'tuple' object has only read-only attributes (assign to .__names__)
>
> Regards,
> Bengt Richter
we were discussing a feature that doesn't yet exist. i believe it's possible to
get around the recursion issue by only allowing the __names__ attribute to be
accessed in the immediate explicitly called tuple. i really do like the idea of
named tuple elements.
bryan
More information about the Python-list
mailing list