Is there any way to check if an item in specific location in a multiple
dimension nested exist?  For example something like:

if M_list[line][row][d] exist:
  do_something_0
else:
  do_something_1


Certainly:
<code>
try:
   M_list[line][row][d]
except IndexError:
   do_something_1
else:
   do_something_0
</code>

Assuming that you want to check because something in `do_someting_0' fails
if the item isn't defined, it is very likely that this can be shortened to:

<code>
try:
   do_something_0
except IndexError:
   do_something_1
</code>

The try/except should be wrapped as tightly as possible around the specific
code that actually throws the exception.

Matt
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to