How to extend inner classes?

Discussion in 'Python' started by hfellerm@uni-osnabrueck.de, Nov 27, 2004.

  1. Guest

    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

    >>> from cGrid import *
    >>> grid = PeriodicGrid(10,10)
    >>> pos = grid.Pos(1,2)


    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 -
    , Nov 27, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Carlo v. Dango
    Replies:
    14
    Views:
    1,031
    Alex Martelli
    Oct 19, 2003
  2. Kay Schluehr

    How to extend inner classes?

    Kay Schluehr, Nov 27, 2004, in forum: Python
    Replies:
    1
    Views:
    340
    Alex Martelli
    Nov 28, 2004
  3. Kay Schluehr

    How to extend inner classes?

    Kay Schluehr, Nov 28, 2004, in forum: Python
    Replies:
    0
    Views:
    346
    Kay Schluehr
    Nov 28, 2004
  4. harold fellermann

    How to extend inner classes?

    harold fellermann, Dec 21, 2004, in forum: Python
    Replies:
    0
    Views:
    361
    harold fellermann
    Dec 21, 2004
  5. Juha Nieminen
    Replies:
    9
    Views:
    923
    Kai-Uwe Bux
    Jun 13, 2011
Loading...

Share This Page