Reputation: 118680
Are there any best practices for the use of higher-level Python constructs such as threading.Condition
, and collections.deque
from modules written in C? In particular:
Upvotes: 1
Views: 134
Reputation: 799310
String lookups on a dict are very cheap in Python, but if desired you can cache them in a struct.
There usually is no provision for doing so, since these libraries are meant to be accessed via Python and not C. It is still possible to generate your own headers that match the definitions in the C modules, but they would need to be maintained per Python version.
There's no good answer for this one. It comes down to "fast" vs. "fast enough".
Upvotes: 2