[Python-ideas] namedlist() or Record type

anatoly techtonik techtonik at gmail.com
Fri Jul 26 12:36:14 CEST 2013


On Wed, Jul 24, 2013 at 12:25 PM, Ronald Oussoren
<ronaldoussoren at mac.com> wrote:
>
> Namedtuple has an _update method, which would allow you to
> write the code below if tcgetattr returns a named tuple:
>
>      newattr = newattr._replace(cflag=newattr.cflag & ~termios.ICANON)
>
> However, tcgetattr does not return a namedtuple :-)

Converting is possible, even if it looks ugly to call private method
outside of class, but it is also unclear if tcsetattr() can accept
nametuples.

> What do you mean by "namedtuple [...] seems not serializable"? Both
> pickle and json work fine with named tuples.

While searching archive for similar topic I've found this one, which
says that namedtuple pickling is "sometimes possible":
https://groups.google.com/forum/#!topic/python-ideas/Pw0hNdiTu8A

--
anatoly t.


More information about the Python-ideas mailing list