control structures (was "Re: Sins")

Eugene Goodrich bitbucket at isomedia.com
Thu Jan 6 20:19:55 EST 2000


On 7 Jan 2000 00:37:29 GMT, neelk at brick.cswv.com (Neel Krishnaswami)
wrote:

>Darrell <darrell at dorb.com> wrote:
>> From: "Skip Montanaro"
>> >
>> > I find nothing wrong with it.  Some people object to using try/except for
>> > anything but handling errors however.
>> 
>> Don't know if this if fair. But exceptions are slow when raised.
>
>Random question: why?
>
>When I tried timing a dummy loop with 100,000 exceptions versus 100K
>function calls, I found that the exceptions took roughly 3 times
>longer. (On CPython 1.5.2)
>

Random postulate - could it have to do with the creation of the
exception object?  _I'm_ sure not qualified to know, test, or examine
this answer, so it's up to the next person...

      -Eugene
import binascii; print binascii.a2b_base64 ('ZXVnZW5lQGlzb21lZGlhLmNvbQ==')



More information about the Python-list mailing list