Can the class definition ('sesameEpisodeNTC = '...) be made an attribute of another class? I'd prefer to keep some namedtuples inside classes to avoid cluttering the module namespace. But this causes problems with pickling (cPickle, dill), which is a showstopper.

Similarly, I've noticed the first parameter of the namedtuple class definition, the typename (i.e. 'sesameEpisodeNTC') must be the name of the class, otherwise pickling does not work. (using both 2.7 and 3.4) That duplication is not ideal. Are there other best practices for the typename parameter, and does it affect code beside pickling code?

Are there other not-widely-documented corner cases I'm missing with namedtuples? It's annoying that some of python's most useful data structures have sharp corners that can snag on parts of the stdlib.

If you make the namedtuple definition at the module level, dill can pickle the class with the namedtuple class object as an attribute. Of course, this doesn't help you "reduce clutter". I think the answer is no. At the moment, you can not define a namedtuple inside a class and have it pickled by default.

There is a ticket/issue on dill github to be able to do better, but right now no -- you'd have to live with module-level namedtuples -- and yes, they need to have the same name as the first parameter of the namedtuple.

Email codedump link for Where should I define namedtuple classes in Python - which namespace?