Why should I use CamelCase for namedtuple?
Question: Assuming this code snippet (ipython)

    
    
    In [1]: from collections import namedtuple
    In [2]: type(namedtuple)
    Out[2]: function
    

you can see that factory function `namedtuple` is a `function`, of course. I
can't see any hint in PEP-8 to use the naming convention for classes in that
case. I can only see that the
[documentation](https://docs.python.org/dev/library/collections.html#collections.namedtuple)
treating it like a class as a naming convention.

Why should one use the naming convention for classes in that case?


Answer: You're referring to the use of the name `Point` for the type returned by
`namedtuple`. `namedtuple` is a function alright, but it returns a class (a
thing that has the type `type`). And by [PEP-8, class names should look
LikeThis](https://www.python.org/dev/peps/pep-0008/#class-names).

    
    
    In [1]: from collections import namedtuple
    In [2]: Point = namedtuple('Point', ['x', 'y'])
    In [3]: type(Point)
    Out[3]: type
    

