Class constant for extension

Yue.Nicholas at gmail.com Yue.Nicholas at gmail.com
Tue Dec 19 05:52:11 EST 2006


Hi,

  I have written a small prototype Python extension for a C-library.

  I have the methods all sorted out and it is working fine.

  In the C-library, they are various constants of types like string,
integer, float and matrix. I'd like to expose them as READONLY values.

  Is the use of PyMemberDefs a suitable way to provide such access?

  I'd like the user of the extension to be able to do something like
the follow

  import MyExtension

  MyExtension.begin()
  mv = MyExtension.minValue
  MyExtension.process(MyExtension.versionStr)
  MyExtension.end()

  Is someone able to point me to an example code of how I can write my
extension so that the references to those constants can be used in the
above way.

Regards




More information about the Python-list mailing list