Constructor documentation assigned to class or __init__?

Yermat loic at
Thu Jun 17 09:03:17 CEST 2004

Leif K-Brooks wrote:
> Should a class's constructor be documented in the class's docstring or 
> __init__'s docstring? For instance:
> class Foo(object):
>     """This class represents mating lizards. Constructor requires one 
> argument, the lizard this lizard is mating with."""
>     def __init__(self, other):
>         pass
> # or
> class Bar(object):
>     ""This class represents mating lizards."""
>     def __init__(self, other):
>         """Initiate the object. Requires one argument, "other", which is 
> the lizard this lizard is mating with."""
>         pass

Think as a user of your library: Where will you look at if you do not 
know how to use a class ?


More information about the Python-list mailing list