c - Equivalent expression in Python -


i python n00b , @ risk of asking elementary question, here go.

i porting code c python various reasons don't want go into.

in c code, have code reproduce below.

float table[3][101][4]; int kx[6] = {0,1,0,2,1,0}; int kz[6] = {0,0,1,0,1,2}; 

i want equivalent python expression c code below:

float *px, *pz; int lx = lx; /* constant defined somewhere else */ int lz = lz; /* constant defined somewhere else */ px = &(table[kx[i]][0][0])+lx; pz = &(table[kz[i]][0][0])+lz; 

can please me giving me equivalent expression in python?

here's thing... can't pointers in python, you're showing here not "portable" in sense that:

float *px, *pz;    <-- doesn't exist int lx = lx; /* constant defined somewhere else */ int lz = lz; /* constant defined somewhere else */ px = &(table[kx[i]][0][0])+lx; pz = &(table[kz[i]][0][0])+lz; ^    ^                      ^ |    |                      | +----+----------------------+---- therefore none of makes sense... 

what you're trying have pointer offset in multidimensional array table, because can't in python, don't want "port" code verbatim.

follow logic beyond this, doing px , pz? code need understand try , port.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -