There's not much use in doing that because they are passed back as tuple
anyway, so they are always converted to Python objects.
It's worth declaring the return type as tuple, though.
Stefan
We have talked about allowing a return of, e.g, (int, int, int, int)
which woud get packed as a struct in C (and as a tuple in Python for
cpdef functions).
- Robert
That would be nice, yes. It would easily work for C types (as above), but
we don't currently support Python objects in structs (IIRC) and that's
semantically tricky, so there may be limits to what we can do with this
approach.
Stefan
In the meantime, you can return a struct and manually unpack it to
achieve the same effect.
Any objections to the
cdef (int, double, object) foo():
...
a, b, c = foo()
syntax? The tricky part is if/how to do recounting on
a = b = foo()
I suppose, given that this is a special, implicit type that all
assignments would be handled by Cython.
- Robert
I think the same as for
def func((a,b)): ...
applies here (bug 692).
Stefan