[Python-ideas] namedlist() or Record type

Yuval Greenfield ubershmekel at gmail.com
Wed Jul 24 11:09:04 CEST 2013


On Wed, Jul 24, 2013 at 10:50 AM, anatoly techtonik <techtonik at gmail.com>wrote:

>
>             newattr[3] &= ~termios.ICANON
>
> I want to get rid of magic number 3 without defining additional
> variables just for names. I thought that namedtuple can help here, but
> it is read-only and seems not serializeable.
>
>
>
This indeed would be useful in the csv module as DictReader/DictWriter are
cute but the [""] are a bit extraneous. And it'd be a useful impromptu,
mutable replacement for namedtuple.

The only minor problem I foresee is when you have illegal python words as
headers (e.g. named.class or named.break) but then you can fall back to
[""]. But now you have more than one way to do it.

Yuval
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130724/6709149f/attachment.html>


More information about the Python-ideas mailing list