Author ifreecarve
Recipients docs@python, eric.araujo, georg.brandl, ifreecarve, r.david.murray, rhettinger, sbt
Date 2017-07-09.11:30:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1499599810.19.0.966876201836.issue10438@psf.upfronthosting.co.za>
In-reply-to
Content
I agree that the use case is probably rare.

I agree that to someone intimately familiar with the "self-consistent rules" of Python, the correctness of the C.f() approach is probably obvious.

However, your documentation says:

    Static methods in Python are similar to those found in Java or C++.

I feel that it's a mistake to purposefully avoid saying where that similarity ends.  In those languages (and in many others), fully qualified function calls from within the same class are redundant and border on "code smell".  We agree that this aspect of Python is not mentioned in the documentation, and we disagree on whether it should be.  For myself, even in the 7 years and thousands of lines of Python since I opened this issue, I still don't find it intuitive or obvious that a method would need to know the name of the class that contains it.  That doesn't make the language "wrong" in any way; it makes the documentation incomplete for not addressing it.  

The __class__.f() usage in Python 3 seems excellent.  If that's the preferred way to do it, then that might be a way to approach the documentation.  "To call one static method from another within the same class, as of Python 3 you may use __class__.f() instead of C.f().  For Python 2.x, you must still use the name of the class itself, C.f(), as if you were calling from outside the class."  (My wording is still less than ideal, but you get the idea.)
History
Date User Action Args
2017-07-09 11:30:10ifreecarvesetrecipients: + ifreecarve, georg.brandl, rhettinger, eric.araujo, r.david.murray, docs@python, sbt
2017-07-09 11:30:10ifreecarvesetmessageid: <1499599810.19.0.966876201836.issue10438@psf.upfronthosting.co.za>
2017-07-09 11:30:10ifreecarvelinkissue10438 messages
2017-07-09 11:30:09ifreecarvecreate