[docs] [issue10289] Document magic methods called by built-in functions

Andy Maier report at bugs.python.org
Fri Jul 4 17:26:17 CEST 2014


Andy Maier added the comment:

I have reviewed the descriptions of the built-in functions in Python 3.4, and found only the following issues w.r.t. missing __special__functions:

1. getattr(), setattr(), delattr(): They only refer to object attributes and miss to mention the fallback to object.__getattr__(), etc. Because hasattr() calls getattr() to test for the presence, the __getattr__() is relevant for hasattr() as well.

2. len() misses to describe that it uses s.__len__().

3. sorted() misses to describe how rich comparison methods can be used. I think we can integrate the changes to list.sort() proposed in issue14050.

4. str() delegates the description to stdtypes.html#str, which in turn does describe obj.__str__(). Not sure we need to do something for str().

I did not check 2.7 yet.

Andy

----------
nosy: +andymaier
versions: +Python 3.4, Python 3.5 -Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10289>
_______________________________________


More information about the docs mailing list