Quick Correction
Andrew Murray
mr.murray at mindspring.com
Tue Sep 4 00:04:52 EDT 2001
Grrrr....
Please read:
dataMembers = append(myOtherClass("hello from # " + str(i))
As:
dataMembers.append(myOtherClass("hello from # " + str(i))
"Andrew Murray" <mr.murray at mindspring.com> wrote in message
news:9n1jdn$ads$1 at slb3.atl.mindspring.net...
> Hi,
>
> I'm looking into writing some types in C for use in a Python program
> I'm working on. I've been reading and it looks really easy (especially
> with SWIG) to create a simple type in C for use in python, but does
anybody
> know
> how (or can point me to a good reasource on how) to create a type in C
> whose data members would be other types written in C? For instance, if I
> wanted to recreate this (ficticious) type:
>
> Class myClass():
> dataMembers = []
> def __init__(self, integer_input):
> i=0
> while(i < integer_input):
> dataMembers = append(myOtherClass("hello from # " + str(i))
> def printMessages(self):
> for member in self.dataMembers:
> member.printMessage()
>
> Class myOtherClass():
> message = ''
> def __init__(self, string_input):
> self.message = string_input
> def printMessage(self):
> print self.message
>
> I hope this example is clear... Please advise
>
> Thanks,
>
> Andrew Murray
>
>
More information about the Python-list
mailing list