471,330 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

How to access nested structural members from python

Hi
I would like to know if there are any ways to access the members of a
nested structure inside python. I use SWIG as interface for C. My
structure comes as follows.
struct SA{
int nb_dep, max_dep
SB *b
}

struct SB{
int id[10], node, kg;
double dep[3];
}

I have written a C helper function like this to access the internal
members of the structure SB.
SB get_sb(SB *b, int index){
return(b[index]);
}
From python i call like this for example:
>>modname.get_sb(sb, i).node where i=1,2....N
What i would like to know is that any other way to access the internal
pieces of nested structure. Any ideas in this regard are most welcome.
Nov 29 '07 #1
0 899

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by John Harrison | last post: by
5 posts views Thread by Fabio Rossi | last post: by
5 posts views Thread by Markus Ernst | last post: by
17 posts views Thread by Jelmer | last post: by
6 posts views Thread by moondaddy | last post: by
3 posts views Thread by tzuriel | last post: by
3 posts views Thread by puzzlecracker | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.