Python C-API: how to define nested classes?

Serge WEINSTOCK serge.weinstock at uk.bnpparibas.com
Thu May 16 04:55:07 EDT 2013


Hi,

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 such nested class with the C-API?

Serge WEINSTOCK


___________________________________________________________
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is prohibited.

Please refer to http://www.bnpparibas.co.uk/en/email-disclaimer/ for additional disclosures.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130516/07a15feb/attachment.html>


More information about the Python-list mailing list