You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe make the current objects in Trio simply redirect to the outcome objects until the next version, deprecating them in 0.5 (with a redirect) and removing in 0.6.
There may be a small bit of awkwardness here because outcome also tweaked the API: Result.capture got replaced with outcome.capture instead of outcome.Outcome.capture. This is probably a good change on its own merits (the only reason I stuck capture onto the Result type was because I didn't have a proper module to put it on), but it means we can't just alias Result to outcome.Outcome and have everything work. The simplest thing might be to do:
classResult(Outcome):
@classmethoddefcapture(...):
...
@classmethod(...)asyncdefacapture(...):
...
Result.register(Outcome) # yes, they're subclasses of each other, what's wrong with that?
Gross hacks are fine because it's just a temporary shim that we'll throw away in a few versions after the deprecation period...
Oh, you mean because right now someone could write Value.capture(...), and that would break if we do Value = outcome.Value? I guess that's technically true, but I doubt anyone's ever done that and I'm fine with just ignoring it. So I think I'm agreeing with your suggestion.
Activity
njsmith commentedon Apr 14, 2018
CC @RazerM
There may be a small bit of awkwardness here because
outcomealso tweaked the API:Result.capturegot replaced withoutcome.captureinstead ofoutcome.Outcome.capture. This is probably a good change on its own merits (the only reason I stuckcaptureonto theResulttype was because I didn't have a proper module to put it on), but it means we can't just aliasResulttooutcome.Outcomeand have everything work. The simplest thing might be to do:Gross hacks are fine because it's just a temporary shim that we'll throw away in a few versions after the deprecation period...
RazerM commentedon Apr 14, 2018
@njsmith We'll have a problem there from
https://github.com/python/cpython/blob/1672c2fbae6128ee4717e08c4e65a0ab99a02a02/Lib/abc.py#L162-L164
njsmith commentedon Apr 15, 2018
Bah, fine. I bet CPython isn't any fun at parties either.
In this case I think it would be enough to register just the concrete classes
outcome.Valueandoutcome.Error.Fuyukai commentedon Apr 15, 2018
The issue with this is that I cannot see a way to meet all of the following:
If the first point is lifted, it can simply be Value = outcome.Value / Error = outcome.Error and register them as virtual subclasses of Result.
njsmith commentedon Apr 15, 2018
Oh, you mean because right now someone could write
Value.capture(...), and that would break if we doValue = outcome.Value? I guess that's technically true, but I doubt anyone's ever done that and I'm fine with just ignoring it. So I think I'm agreeing with your suggestion.