Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #34478

empty object from C

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!feeds.news.ox.ac.uk!news.ox.ac.uk!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <eric.frederich@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; 'attributes': 0.07; 'msg': 0.07; 'python': 0.09; 'def': 0.10; 'instantiate': 0.16; 'subject:object': 0.16; 'instance,': 0.17; 'thanks,': 0.18; 'lets': 0.22; 'object.': 0.22; "i'd": 0.22; 'sets': 0.23; 'pass': 0.25; 'message-id:@mail.gmail.com': 0.27; 'dictionary': 0.29; 'class': 0.29; 'function': 0.30; 'function.': 0.33; 'to:addr:python-list': 0.33; 'that,': 0.34; 'received:google.com': 0.34; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'received:209': 0.37; 'object': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'takes': 0.39; 'hello,': 0.39; 'header:Received:5': 0.40; 'this...': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=7Qcz5dt1mvWJ2PviVwKqvTaze+OHPZxHRNWO5W99KNA=; b=En9OiheT/NNRDtZSQHg0whFRjpX71EHH6Sa1o50QM4jX5LW3wC/+XcmfRMuQ0+L8j9 R1fGie/kdxWDGB7PzDsfVTh3EkdChhpDrCQzcmWIPPGsn5e06TWTx+hk39ATjlFvES+S 79oLI6k5HXkKfdG/iljHXPjO9zsRBhRMdK1MXPsFMucZUGgDNPeBHA9Sc+OWTGJ0hGC9 8206MoPM0NMpFMFZm24L2f2tCjcepNrHLf/LcuA5CEUreEbs3q1hMy4ioAmjJvNqPFdd rCAoF+qXguWiwqaT+cKAEM8NnXB7ZneG7wQcCrUQhAocvCp1o2GUo9VedsSViHOPVklK kl8w==
MIME-Version 1.0
Date Fri, 7 Dec 2012 10:42:28 -0500
Subject empty object from C
From Eric Frederich <eric.frederich@gmail.com>
To python-list@python.org
Content-Type multipart/alternative; boundary=f46d04462cb6244eba04d045102e
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.612.1354898619.29569.python-list@python.org> (permalink)
Lines 49
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1354898619 news.xs4all.nl 6985 [2001:888:2000:d::a6]:34562
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:34478

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

empty object from C Eric Frederich <eric.frederich@gmail.com> - 2012-12-07 10:42 -0500

csiph-web