16 Feb
2013
16 Feb
'13
10:18 a.m.
On Sat, 16 Feb 2013 15:51:28 +1100
Steven D'Aprano
from collections import namedtuple
FIELDNAMES = """...""" # Format it however you like.
class MyClassWithAnExtremelyLongName(namedtuple("Cheese", FIELDNAMES)): pass
Still not very elegant IMO (and it introduces spurious globals in the module). Parameters for class construction shouldn't be outside of the class declaration. Really, the class declaration syntax has been *designed* to deal with all of this. It's counter-productive to try not to use it. (but, yes, now the official namedtuple API is the one we know, I agree that having two ways to do it may be one too many) Regards Antoine.