2

I'm currently writing a C extension module for python using the "raw" C-API. I would like to be able to define "nested classes" like in the following python code

class A:
    class B:
        def __init__(self):
            self.i = 2
    def __init__(self):
        self.b = A.B()
a = A()
b = A.B()
print(a.b.i)
print(b.i)

How can I create with the C-API a nested class like A.B?

Serge Weinstock
  • 1,235
  • 3
  • 12
  • 20

0 Answers0