empty object from C

Discussion in 'Python' started by Eric Frederich, Dec 7, 2012.

  1. Hello,

    >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):
    pass

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

    msg = Msg()
    foo(msg)



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

    Thanks,
    ~Eric
     
    Eric Frederich, Dec 7, 2012
    #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. John

    empty/non-empty element

    John, Jul 15, 2003, in forum: XML
    Replies:
    1
    Views:
    1,046
    Klaus Johannes Rusch
    Jul 16, 2003
  2. Lukas
    Replies:
    3
    Views:
    835
    spiff
    Nov 10, 2005
  3. Marcia Hon

    Check if a directory is empty and empty it

    Marcia Hon, Feb 8, 2004, in forum: C Programming
    Replies:
    8
    Views:
    587
    Dave Thompson
    Feb 14, 2004
  4. Brian Roberts

    empty lists vs empty generators

    Brian Roberts, May 3, 2005, in forum: Python
    Replies:
    12
    Views:
    671
    Jeremy Bowers
    May 4, 2005
  5. ButlerDJIAM
    Replies:
    0
    Views:
    573
    ButlerDJIAM
    Nov 9, 2006
Loading...

Share This Page