>The C implementation has this code: > >""" > if (PyDict_DelItem(so->data, item) == -1) { > if (!PyErr_ExceptionMatches(PyExc_KeyError)) > return NULL; > PyErr_Clear(); > } >""" > >Which is more-or-less the same as the sets.Set version, right? What I was >wondering was whether changing that C to a C version of your dict.pop() >version would also result in speedups. Are Exceptions really that slow, >even at the C level? 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. -- Andrew McNamara, Senior Developer, Object Craft http://www.object-craft.com.au/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4