I have a function in RPython that returns a tuple, and based on different
situations, one value or the other may "null":

def decide(x):
  if x:
    return 42, None
  else:
    return 0, Object("some value")


Here's the issue, this function is part of some meta-programming and is
auto generated. So the issue is, when I return `0, Object("some value")` I
really don't know what the first member of the tuple is, I want it to be
some value, and it can be anything since the calling function is
dispatching on the second value of the tuple being None (or not).

Is there some sort of way in rpython to say "return any value that fits the
type expected here?"

Or perhaps there's some better way to do a tagged union of sorts in
rpython.

Thanks,

Timothy
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to