By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,898 Members | 1,245 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,898 IT Pros & Developers. It's quick & easy.

How to access nested structural members from python

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.