Amaury Forgeot d'Arc added the comment:
namedtuple has a _replace method, but I agree that it would be an incompatible
change. "namedlist" someone?
class tcattributes(object):
__slots__ = ['iflag', 'oflag', 'cflag', 'lflag', 'ispeed', 'ospeed', 'cc']
def __new__(cls, values):
self = object.__new__(cls)
for attr, value in zip(cls.__slots__, values):
setattr(self, attr, value)
return self
def __getitem__(self, index):
return getattr(self, self.__slots__[index])
----------
nosy: +amaury.forgeotdarc
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18535>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com