> > Um, I'm afraid this is how it is. __xxx__ methods have generic > > docstrings. :-( > > Can you just clarify a bit what you mean by "this": > would my idea of poking a docstring into the wrapper > object work, or do all types share the same wrappers? > > It seems as though they *don't* share the same wrappers... > > Python 2.2 (#1, Jul 11 2002, 14:19:37) > >>> id(int.__dict__['__add__']) > 135662196 > >>> id(float.__dict__['__add__']) > 135668268 > > ...or is there some magic going on there that I'm > not aware of? The descriptors are indeed separate objects, because they wrap different C implemetations (int vs. float add). But they contain a pointer to a static piece of data which is shared by all wrappers, and that's where they get their docstring. --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4