Python functools.namedtuple

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?

Best answer

In Python 3.2.2, functools.py contains the following import:

from collections import OrderedDict, namedtuple

It seems pretty clear that it’s just a convenience import for the module’s implementation, and is not intended to be part of its public interface.