People call this "positional expansion" or argument unpacking. Your instance should provide an __iter__
method, which is called when iterating over this object. However, I think the cleanest approach would be to subclass collections.Iterable
, which is the abstract base class for all iterables in Python.
Note that this is the same question for keyword argument unpacking, requiring the object to be a mapping.
Edit: I am still trying to find the exact implementation in this case to see which C API call is used for unpacking. This would yield the precise answer to this question. Any pointers?