Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

Hit <submit> too early.

In Python, the norm is that the class name is documented.  When you call the 
class, the __init__() method gets called automatically (as documented in the 
language reference and in the tutorial).

For example:

    >>> class A:
            def __init__(self, seq):
                    self._seq = seq
            def __len__(self):
                    return len(self._seq)
      
    >>> a = A('apple')
    >>> len(a)    
    5

In this example, we document that class "A" can be called with a sequence and 
that len() can be called on instances of A.  The "dunder" methods are public, 
but are called and documented indirectly.  The "_seq" attribute is marked as 
private and would not be documented, since it is an implementation detail and 
not intended to be accessed directly.

----------

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

Reply via email to