How to extend inner classes?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • hfellerm@uni-osnabrueck.de

    #1

    How to extend inner classes?

    Hi all,

    I try to implement a C extension module that uses inner classes. The
    structure of the corresponding python code is the following:

    class PeriodicGrid :
    class Pos :
    # [...]

    class NofluxGrid :
    class Pos :
    # [...]

    I wrote the PyTypeObjects for PeriodicGrid, NofluxGrid, PeriodicPos, and
    NofluxPos. Now I want to add each PosType to the appropriate Grid's
    dictionary, so that I can write something like
    [color=blue][color=green][color=darkred]
    >>> from cGrid import *
    >>> grid = PeriodicGrid(10 ,10)
    >>> pos = grid.Pos(1,2)[/color][/color][/color]

    in my python program. What is the general way to add class members
    (instead of instance members which is done by a PyMemberDef array) to the
    PyTypeObject?

    Any help appreciated,

    - harold -

Working...