empty object from C

Eric Frederich eric.frederich at gmail.com
Fri Dec 7 16:42:28 CET 2012


>From C, I'd like to call a Python function that takes an object and sets
some attributes on it.
Lets say this is the function...

def foo(msg):
    msg.bar = 123
    msg.spam = 'eggs'

How do I create an empty object in C?
In Python I would do something like this...

class Msg(object):

... and then instantiate an instance, and call the function.

msg = Msg()

I know how to create an empty dictionary and I get get by with that, but
I'd like to create an object.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121207/bed35420/attachment.html>

More information about the Python-list mailing list