[Python-Dev] Faster Set.discard() method?

Barry Warsaw barry at python.org
Fri Mar 18 15:08:20 CET 2005


On Fri, 2005-03-18 at 01:19, Andrew McNamara wrote:

> No, exceptions are fast at the C level - all they do is set a flag. The
> expense of exceptions is saving a restoring python frames, I think,
> which doesn't happen in this case. So the current implementation is
> ideal for C code - clear and fast.

The other advantage for raising and catching exceptions entirely in C is
that the (class) exceptions are never instantiated.  Once you cross the
C-Python barrier you have to pay for that instantiation.

-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20050318/3dd8d91f/attachment.pgp


More information about the Python-Dev mailing list