[Python-Dev] PEP 257 and init (original) (raw)
Terry Reedy tjreedy at udel.edu
Mon Jan 4 02:01:15 EST 2016
- Previous message (by thread): [Python-Dev] PEP 257 and __init__
- Next message (by thread): [Python-Dev] PEP 257 and __init__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 1/3/2016 6:21 PM, Guido van Rossum wrote:
On Tue, Dec 29, 2015 at 1:03 PM, Facundo Batista <facundobatista at gmail.com <mailto:facundobatista at gmail.com>> wrote:
On Tue, Dec 29, 2015 at 4:38 PM, Andrew Barnert <abarnert at yahoo.com_ _<mailto:abarnert at 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.
Ask the PSF/pypi people to either prohibit such names or require a disclaimer of some sort. They are inherently confusing: "I took a look at pep008" does not mean that one even looked at the PEP. Even when the context makes clear that the referent is the module, there is confusion as to its authoritativeness. That Facudo would post here about the module's output illustrates that. To me, the name copying violates our informal trademark within Pythonland on 'PEP####'.
-- Terry Jan Reedy
- Previous message (by thread): [Python-Dev] PEP 257 and __init__
- Next message (by thread): [Python-Dev] PEP 257 and __init__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]