[Python-Dev] r87445 - python/branches/py3k/Lib/numbers.py (original) (raw)

Éric Araujo merwok at netwok.org
Thu Dec 23 22:09:15 CET 2010


Le 23/12/2010 20:55, Antoine Pitrou a écrit :

def index(self): - """index(self)""" + """someobject[self]""" This is misleading as to what the method actually does, Really? Unless I misunderstood the docs, index is used when the object is used as an index (or with bin or oct, but I didn’t want to complicate the docstring, just fix it).

On IRC, R. David Murray said that I could just have deleted the docstring. I agree with that: I think magic methods never need a docstring, since they’re documented once and for all in the language reference. (init is not an exception: its parameters can be documented in the class docstring.)

as you can read in the implementation:

return int(self) The fact that index is implemented thanks to int/int here is a detail IMO.

Regards



More information about the Python-Dev mailing list