On Tue, 30 Oct 2012 06:36:52 +1100, Chris Angelico wrote: > On Tue, Oct 30, 2012 at 6:23 AM, Ian Kelly <ian.g.ke...@gmail.com> > wrote: >> _MyImmutableClass = namedtuple('MyImmutableClass', 'field1 field2 >> field3 field4') >> >> class MyImmutableClass(_MyImmutableClass): > > Question: Is it clearer to take advantage of the fact that the base > class can be an arbitrary expression? > > class MyImmutableClass(namedtuple('MyImmutableClass', 'field1 field2 > field3 field4')):
I'm too lazy to google for it, but if you read the examples provided by namedtuple's creator, Raymond Hettinger, that is precisely one of the styles he uses. No need to explicitly declare the base class before using it. -- Steven -- http://mail.python.org/mailman/listinfo/python-list