I am aware of the existence and purpose of collections.namedtuple
, but I have noticed that, at least in IDLE (3.2.2), this factory function is also in functools
:
>>> import functools
>>> functools.namedtuple
<function namedtuple at 0x024B41E0>
It also exists in collections
as expected, and is the same function:
>>> import collections
>>> collections.namedtuple is functools.namedtuple
True
No docs I can find ever mention namedtuple
being anywhere other than collections. So: is this standard, or just an IDLE weirdness? If it's just IDLE, is it a bug or a Why would namedtuple
be in two places - and, indeed, in whose warped mind does it make sense in functools
of all places?