Scott David Daniels wrote: > >... STeVe stressed that the try/except solution is only really appropriate
> > for cases where the failure to have the variable defined is quite rare. > > Beware: C++ and Java have an immense overhead for exceptions. Python > has a very lightweight exception mechanism. You should _very_seldom_ > choose exceptions or not on the basis of performance without measuring > the actual use; you are sure to be surprised. > > Structure your code to be easiest to understand. _If_ it is too slow, > investigate ways to improve its performance. The usual way is to > build better data structures and use better algorithms. Only in the > core of a frequently used inner loop should you even care about the > cost of exceptions. you haven't really read this thread, have you? </F> -- http://mail.python.org/mailman/listinfo/python-list