0

I have built a class in C with the Python/C API. I now have a requirement to iterate over the data items in the C blob. Returning a PyList is undesirable as length is >50K. Is there a way to provide generator-like functionality?

My one solution is to wrap the class in another pure python class and write the generator function at that level. Is there another way?

Adrian
  • 1

1 Answers1

0

According to PEP 234, all you need to do is implement the tp_iternext slot in your python C class.

Chris Eberle
  • 47,994
  • 12
  • 82
  • 119