How to extend inner classes?

harold fellermann dadapapa at gmx.net
Tue Dec 21 14:40:41 CET 2004


Thank you very much. Of course I know how to do it in python. The
problem is that I want to reimplement these classes as a python
extension in C. The question is: how can I add class members (like
e.g. inner classes) to a PyTypeObject defined in a C extension?

- harold -


> You can define a class variable Pos with the class Pos as its value
> 
> class PeriodicGrid :
>     class Pos:
>  pass            
>     Pos = Pos 
> 
> >>> grid = PeriodicGrid()
> >>> grid.Pos()
> <__main__.Pos instance at 0x00EEFAD0>
> 
> Ciao
>     Kay



More information about the Python-list mailing list