I spent some time investigating the collections.namedtuple module a few weeks ago. The module uses a factory function which populates the dynamic data (the name of the new
As a sidenote: The other objection I see most often against using exec
is that some locations (read companies) disable it for security reasons.
Besides an advanced Enum
and NamedConstant
, the aenum library* also has NamedTuple
which is metaclass
-based.
* aenum
is written by the author of enum and the enum34 backport.