on-internet
← Community

When should a class break the UpperCamelCase naming convention?

Stack Overflow ·

According to PEP 8, class names should use the UpperCamelCase (CapWords) convention. However, I have seen classes use lowercase names. For example, in the standard library: class socket(_socket.socket): ... class defaultdict(dict): ... PEP 8 does allow an exception: The naming convention for functions may be used instead in cases where the interface is documented and used primarily as a callable. What does "documented and used as a callable" mean? Aren't all classes callable as they can be instantiated? Putting aside builtin types, when would it be desirable to use a non-CapWords class name?

Comments

Sign in or sign up to comment and upvote.

No comments yet.