[C++-sig] Re: Boost.Python functions and Python functions

David Abrahams dave at boost-consulting.com
Sun Feb 1 03:29:23 CET 2004


Daniel Holth <dholth at fastmail.fm> writes:

> Boost.Python functions don't inherit from the Python function type, but
> if they did the current version of pydoc would show their docstring.
>
> So, if we want help(boost_module_with_functions) to show something, we
> can change pydoc so it knows about Boost.Python functions, or change
> Boost.Python functions to inherit from the Python function type.

If pydoc really only works on classes derived from Python's builtin
function types, it probably *should* be changed.

> Is there a good reason that Boost doesn't currently subtype Python's
> Function Type for its functions?

You mean aside from:

  >>> def f():pass
  ...
  >>> f.__class__
  <type 'function'>
  >>> class x(f.__class__):
  ...     pass
  ...
  Traceback (most recent call last):
    File "<stdin>", line 1, in ?
  TypeError: type 'function' is not an acceptable base type

??

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list