Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a dedicated, better-named API for creating a Deferred from a coroutine, rather than ensureDeferred whose input type is ambiguous #9825

Closed
twisted-trac opened this issue May 11, 2020 · 4 comments

Comments

@twisted-trac
Copy link

hawkowl's avatar @hawkowl reported
Trac ID trac#9825
Type enhancement
Created 2020-05-11 13:35:23Z

Originally described as:

It made sense in a "like asyncio" way, but... kind of sucks. Deferred.fromCoroutine matches better, perhaps.

But asyncio went through this same evolution, starting with ensure_future and deprecating it in favor of create_task, and that's more or less what we're suggesting here.

Searchable metadata
trac-id__9825 9825
type__enhancement enhancement
reporter__hawkowl hawkowl
priority__normal normal
milestone__None None
branch__ 
branch_author__ 
status__closed closed
resolution__fixed fixed
component__core core
keywords__None None
time__1589204123945671 1589204123945671
changetime__1601773152522108 1601773152522108
version__None None
owner__hawkowl hawkowl

@twisted-trac
Copy link
Author

altendky's avatar @altendky commented

I thought the thing that made 'ensureDeferred()' descriptive was that you could pass in multiple sorts of things, including a deferred, and the function would make sure you had a deferred at the output. A theoretical Deferred.fromCoroutine() should presumably fail if passed a deferred. fromCoroutine() sounds to me like a thing that ensureDeferred() would call when appropriate.

@twisted-trac
Copy link
Author

hawkowl's avatar @hawkowl commented

PR: #1269

@twisted-trac
Copy link
Author

glyph's avatar @glyph set owner to @hawkowl

Reviewed over on Github: #1269 (review)

@twisted-trac
Copy link
Author

twm's avatar @twm set status to closed

In changeset 35ff8e4

#!CommitTicketReference repository="" revision="35ff8e4ca6c979415737a2959727e86e9b48dd00"
Merge pull request #1269 from twisted/9825-ensuredeferred-less-sucky-name

Author: hawkowl, wsanchez
Reviewer: glyph, wsanchez, graingert, twm
Fixes: ticket:9825

Add Deferred.fromCoroutine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants