what is the python equivelant of this?
Neil Schemenauer
nas at arctrix.com
Thu Oct 12 07:03:26 EDT 2000
More information about the Python-list mailing list
Thu Oct 12 07:03:26 EDT 2000
- Previous message (by thread): what is the python equivelant of this?
- Next message (by thread): what is the python equivelant of this?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Oct 12, 2000 at 05:31:21PM +0000, jschmitt at vmlabs.com wrote: > typedef struct > { > int field1; > char* field2; > } RECORD; > > RECORD records[] = > { > { 10, "gumby" }, > { 20, "barny" } > /* etc */ > }; One solution: class Record: def __init__(self, field1, field2): self.field1 = field1 self.field2 = field2 records = [ Record(10, "gumby"), Record(20, "barny"), ] > or how about > > RECORD* recordarray = malloc( sizeof(RECORD) * 10 ); > memset( recordarray0, sizeof(RECORD) * 10 ); What is recordarry0? Maybe something like this is what you want: recordarray = [] for i in range(10): recordarray.append(Record(10, "gumby")) Cheers, Neil
- Previous message (by thread): what is the python equivelant of this?
- Next message (by thread): what is the python equivelant of this?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list