RecompExternalPython for N64Recompiled 2.0.0
Loading...
Searching...
No Matches

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.

Detailed Description

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.

Function Documentation

◆ REPY_Iter()

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.

Parameters
objectThe Python object to get an iterator for. Will be REPY_NO_HANDLE if an error occured.

◆ REPY_Next()

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.

Parameters
iteratorThe Python iterator being used.
default_obj_nullableA default object to return if iteration is complete. Use REPY_NO_OBJECT to ignore this argument.
process_stop_iterationSet to true to enable automatic handling of the StopIteration exception. Set to false otherwise.
Returns
The next object from the iterator. Will be REPY_NO_HANDLE an error occured, or if process_stop_iteration is true and iteration has ended