In article <[EMAIL PROTECTED]>, "leo" <[EMAIL PROTECTED]> wrote:
> Hello all - > > I was wondering about the performance implications of explicitly > raising exceptions to get information about the current frame. > Something like what the inspect module does, with: Python uses exceptions internally, using StopIteration to terminate the iterator in a for: loop. > --- > def currentframe(): > """Return the frame object for the caller's stack frame.""" > try: > raise 'catch me' > except: > return sys.exc_traceback.tb_frame.f_back > --- This also does a traceback; you might want to measure the cost of that. > I come from a java background, where Exceptions are a big Avoid Me, but > are the performance implications the same in Python? We're expecting a > big load on our app (100,000 users/hour) , so we'd like to be as tuned > as possible. Switching to Python, eh? Remember to measure, measure, measure! ________________________________________________________________________ TonyN.:' [EMAIL PROTECTED] ' <http://www.georgeanelson.com/> -- http://mail.python.org/mailman/listinfo/python-list