Functions that operate on REPY_Handle values directly, rather than the Python objects they represent. More...
Functions | |
| REPY_Handle | REPY_Iter (REPY_Handle object) |
| Gets an iterator for a given Python object. | |
| REPY_Handle | REPY_Next (REPY_Handle iterator, REPY_Handle default_obj_nullable, REPY_bool process_stop_iteration) |
| Gets the next Python object from a Python iterator. | |
Functions that operate on REPY_Handle values directly, rather than the Python objects they represent.
The same DLL mechanisms used by these functions are used internally by REPY_IteratorHelper.
| REPY_Handle REPY_Iter | ( | REPY_Handle | object | ) |
Gets an iterator for a given Python object.
This function is analogous to Python's own iter function, and should work in all the same circumstances.
| object | The Python object to get an iterator for. Will be REPY_NO_HANDLE if an error occured. |
| REPY_Handle REPY_Next | ( | REPY_Handle | iterator, |
| REPY_Handle | default_obj_nullable, | ||
| REPY_bool | process_stop_iteration ) |
Gets the next Python object from a Python iterator.
This function is mostly analogous to Python's own next function, and should work in all the same circumstances.
Generally, this function returning REPY_NO_OBJECT indicates that an error has occured, but there is a special case. In Python, the end of iteraton is indicated by the raising of a StopIteration exception. Instead of requiring the user to handle this exception manually handle this exception, the argument process_stop_iteration enables this functin silently and automatically handle the StopIteration exception while still returning REPY_NO_OBJECT. This way, you can easily check whether iteration ended successfully by simply calling REPY_IsErrorSet, instead of having to write more elaborate exception handling code.
| iterator | The Python iterator being used. |
| default_obj_nullable | A default object to return if iteration is complete. Use REPY_NO_OBJECT to ignore this argument. |
| process_stop_iteration | Set to true to enable automatic handling of the StopIteration exception. Set to false otherwise. |