Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-11-01 17:14:50

----- Original Message -----
From: <barry_at_[hidden]>

> > > 3. dir(class) does not list the functions available in the class
> > > (See the code of dir in the Python sources for the names of the
> > > secret names it access via getattr. CXX has support for some
> > > of them.)
> >
> > Isn't __dict__ support enough to accomplish that?
> No as dir looks for __methods__ as a special case.

Sorry, I'm a bit confused, as it seems to work for me with only __dict__
support, and built-in Python classes don't have a __methods__ attribute (at
least, not in Python 1.5.2):

>>> X
<class __main__.X at 84c898>
>>> x.__dict__
Traceback (innermost last):
  File "<stdin>", line 1, in ?
NameError: x
>>> X.__dict__
{'f': <function f at 84c848>, '__doc__': None, '__module__': '__main__'>}
>>> dir(X)
['__doc__', '__module__', 'f']
>>> X.__methods__
Traceback (innermost last):
  File "<stdin>", line 1, in ?
AttributeError: __methods__
>>> X().__methods__
Traceback (innermost last):
  File "<stdin>", line 1, in ?
AttributeError: __methods__

Boost list run by bdawes at, gregod at, cpdaniel at, john at