[EMAIL PROTECTED] writes:
How do i handle this piece of code in python:
# define vZero 15 # define vOne 20
unsigned int vTable[Zero][One]
if(vGroup[vZero][vOne] == 0) { vGroup[vZero][vOne]-- ..... ..... }
Simplest might be with a dictionary:
vGroup = {} # I assume you meant vGroup not vTable if vGroup[(vZero, vOne)] == 0: vGroup[(vZero, vOne)] -= 1 ..... .....
Or, if you like, the parentheses are unnecessary:
vGroup = {} if vGroup[vZero, vOne] == 0: vGroup[vZero, vOne] -= 1 .....
This (or the semantically identical version with parentheses) is definitely the best approach if you expect to have a lot of empty spots in your table.
STeVe -- http://mail.python.org/mailman/listinfo/python-list