Re: Exception raising, and performance implications.

2005-10-04 Thread Tom Anderson
On Mon, 3 Oct 2005, it was written: > "leo" <[EMAIL PROTECTED]> writes: > >> I come from a java background, where Exceptions are a big Avoid Me, but >> are the performance implications the same in Python? > > Well, you could measure it experimentally pretty easily, but anyway, > Python exception

Re: Exception raising, and performance implications.

2005-10-04 Thread Phillip J. Eby
leo wrote: > > You're absolutely right, in fact the code snippet from my OP was taken > directly from inspect.currentframe. We're intending on using this in > production, and I'm trying to gauge what the implications may be. Use sys._getframe() instead; it doesn't raise an exception. > Wow, I wa

Re: Exception raising, and performance implications.

2005-10-04 Thread Steve Holden
leo wrote: >>However, I think the functionality you're asking for is available as >>inspect.currentframe(), and if the implementation is in "C" it may have a tiny >>performance advantage over the Python version. > > > You're absolutely right, in fact the code snippet from my OP was taken > direct

Re: Exception raising, and performance implications.

2005-10-04 Thread leo
> However, I think the functionality you're asking for is available as > inspect.currentframe(), and if the implementation is in "C" it may have a tiny > performance advantage over the Python version. You're absolutely right, in fact the code snippet from my OP was taken directly from inspect.curr

Re: Exception raising, and performance implications.

2005-10-03 Thread jepler
On Mon, Oct 03, 2005 at 02:34:40PM -0700, leo wrote: > 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. I don't kn

Re: Exception raising, and performance implications.

2005-10-03 Thread Tony Nelson
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 intern

Re: Exception raising, and performance implications.

2005-10-03 Thread jepler
As for performance, you'll need to benchmark it. However, I think the functionality you're asking for is available as inspect.currentframe(), and if the implementation is in "C" it may have a tiny performance advantage over the Python version. Jeff pgpENIs7apfaF.pgp Description: PGP signature -

Re: Exception raising, and performance implications.

2005-10-03 Thread Paul Rubin
"leo" <[EMAIL PROTECTED]> writes: > I come from a java background, where Exceptions are a big Avoid Me, but > are the performance implications the same in Python? Well, you could measure it experimentally pretty easily, but anyway, Python exceptions are much less expensive than Java exceptions. -

Exception raising, and performance implications.

2005-10-03 Thread leo
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: --- def currentframe(): """Return the frame object for the caller's stack frame.""" try: r