On Tue, Dec 29, 2015 at 1:03 PM, Facundo Batista <facundobati...@gmail.com>
wrote:

> On Tue, Dec 29, 2015 at 4:38 PM, Andrew Barnert <abarn...@yahoo.com>
> wrote:
>
> > Isn't the same thing true for every special method? There are lots of
> classes where __add___ just says "a.__add__(b) = a + b" or (better
> following the PEP) "Return self + value." But, in the rare case where the
> semantics of "a + b" are a little tricky (think of "a / b" for
> pathlib.Path), where else could you put it but __add__?
> >
> > Similarly, for most classes, there's only one of __init__ or __new__,
> and the construction/initialization semantics are simple enough to describe
> in one line of the class docstring--but when things are more complicated
> and need to be documented, where else would you put it?
>
> Yeap. Note that I'm ok to include a docstring when the actual
> behaviour would deviate from the expected one as per Reference Docs.
> My point is to not make it mandatory.
>
>
> > I usually just don't bother. You can violate PEP 257 when it makes
> sense, just like PEP 8. They're just guidelines, not iron-clad rules.
>
> Yeap, but pep257 (the tool [0]) complains for __init__, and wanted to
> know how serious was it.
>
>
> [0] https://pypi.python.org/pypi/pep257


That is the tool's fault. I personally hate with a vengeance that there are
tools named after style guide PEPs that claim to enforce the guidelines
from those PEPs. The tools' rigidity and simplicity reflects badly on the
PEPs, which try hard not to be rigid or simplistic.

-- 
--Guido van Rossum (python.org/~guido)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to