For reasons I won't go into I ended up defining classes inside of
a class body. That's not in the manual, but I see no reason it would
fail.
But then, I accidentally decorated the inner classes with
@staticmethod! It didn't break anything, but it had an interesting
side effect: help() and pydoc on the outer class shows the docs
of the inner class members. Normally only the inner classes are
listed, not their contents.
Here's a minimal example.
----------------------------------------------------------------------
class Outer:
'''Outer class'''
def outer_method(self):
'''outer method'''
class Inner0:
'''Inner class'''
def inner_0(instance):
'''inner method, not seen by pydoc.'''
@staticmethod
class Inner1:
'''Inner class passed through staticmethod()'''
def inner_1(instance):
'''inner method, visible to pydoc !'''
----------------------------------------------------------------------
Save and run pydoc, or import and run help(_module_.Outer).
Now that's *seriously* not-in-the-manual. I won't rely on that
behavior, plus the expanded documentation is a bit too much,
but I'm curious as how that interaction between staticmethod()
and help()/pydoc came about.
--
pa at panix dot com
--
https://mail.python.org/mailman3//lists/python-list.python.org