Py iterator slots

Asked by sean ross

Are the python __iter__ and __next__ methods supported? If so can you please point me to an example? I can not seem to get it to work.

Thank you

Question information

Language:
English Edit question
Status:
Answered
For:
PyBindGen Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Gustavo Carneiro (gjc) said :
#1

No, there's not code to directly adapt __iter__ and __next__ into slots. The closest you can find is CppClass.add_container_traits. Example usage in tests/foomodulegen_common.py, line 127:

    VectorLike2.add_container_traits(ReturnValue.new('double'), begin_method='Begin', end_method='End', iterator_type='Iterator')

Can you help with this problem?

Provide an answer of your own, or ask sean ross for more information if necessary.

To post a message you must log in.