[C++-sig] Static Methods - correction

Francois Ostiguy ostiguy at fnal.gov
Mon Nov 4 21:05:45 CET 2002

There was a mix-up in my previous message. Once again, I have been
trying, without success, to expose a static member of a class

The python output is as follows:

Python 2.2.2 (#1, Oct 28 2002, 17:04:52)
[GCC 3.1.1] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> from orbit import *
>>> a = Ring()
>>> a
<orbit.Ring object at 0x1638f0>
>>> a.initNodes()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: bad argument type for built-in operation
>>> Ring.initNodes()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: unbound method Boost.Python.function object must be called with
Ring instance as first argument (got nothing instead)

Ring::initNodes() is declared as a static member of the c++ class Ring.
I understand, based on Dave's comments  that  a.initNodes() will not
work.  I do not understand why the second form  Ring.initNodes() fails.
Is there a simple way to expose static member functions ?

Your help is greatly appreciated.


Dr. Jean-Francois OSTIGUY                              voice: (630) 840-2231
Beam Physics Dept MS220                                  FAX: (630) 840-6039
Fermi National Accelerator Laboratory                email: ostiguy at fnal.gov
Batavia IL 60510-0500                           WWW:www-ap.fnal.gov/~ostiguy

More information about the Cplusplus-sig mailing list