Nick Coghlan <ncogh...@gmail.com> added the comment:

A useful heuristic is that if something is named with CapWords, then class-like 
*usage* is explicitly supported (inheritance, isinstance checks, etc).

If it's named with snake_case or wordsruntogether, then calling it is OK, but 
you may run into quirky behaviour in class-style usage (e.g. it may not be a 
class at all in some implementations, or it may not be friendly to subclassing 
even when it is a full class).

So for something like this, snake_case is appropriate - you're meant to just 
use it, not subclass it. The fact that it's a type instance is an 
implementation detail.

(In other cases like contextlib.contextmanager we've made that implementation 
details status completely explicit in the code by having the public API be a 
wrapper function that returns an instance of a private class)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31356>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to