I have a simple way to solve this I believe.

Why not just expose "_chain_future()" from asyncio/futures.py to the
public, instead of copying and pasting parts of it?

It already works, being used everywhere in the stdlib, it supports both
asyncio and concurrent.futures, it's an easily testable external function
(follows the design of asyncio for the better part), it's threadsafe right
out of the box and it wouldn't require anything but removing a single
underscore and adding documentation. (I always wondered why was it private
anyway)

It's like the function was meant to be public :-P

-- Bar

On Fri, Jan 26, 2018, 8:07 AM Guido van Rossum <gu...@python.org> wrote:

> I really don't want to distract Yury with this. Let's consider this (or
> something that addresses the same need) for 3.8.
>
> To be clear this is meant as a feature for concurrent.futures.Future, not
> for asyncio.Future. (It's a bit confusing since you also change asyncio.)
>
> Also to be honest I don't understand the use case *or* the semantics very
> well. You have some explaining to do...
>
> (Also, full links: https://bugs.python.org/issue32672;
> https://github.com/python/cpython/pull/5335)
>
> On Thu, Jan 25, 2018 at 8:38 PM, Daniel Collins <dancollin...@gmail.com>
> wrote:
>
>> Hello all,
>>
>> So, first time posting here. I’ve been bothered for a while about the
>> lack of the ability to chain futures in python, such that the next future
>> will execute upon the first’s completion.  So I submitted a pr to do this.
>> This would add the .then(self, fn) method to concurrent.futures.Future.
>> Thoughts?
>>
>> -dancollins34
>>
>> Github PR #5335
>> bugs.python.org issue #32672
>>
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas@python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>>
>
>
> --
> --Guido van Rossum (python.org/~guido)
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to