On 05/16/2012 10:11 AM, Nick Coghlan wrote: > Use PyObject_HasAttr, just as people use hasattr() for ducktyping in Python. In the Cython wrap-function-pointers case we really want performance comparable to C, so we couldn't do the whole thing. But I guess we could intern some char* (somehow), pass that to tp_getattr, and then cast the returned PyObject* (which would not be a PyObject*) to a custom struct. As long as the interned strings can never be reached from Python that's almost safe. It's still slight abuse of tp_getattr. As I said, if we didn't worry about performance we'd just retrieve capsules through attributes. Dag > > If you want something more structured, use Abstract Base Classes, > that's what they're for. > > Cheers, > Nick. >
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