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

function calling support coroutine function #90

Closed
wants to merge 4 commits into from

Conversation

canwushuang
Copy link
Contributor

@canwushuang canwushuang commented Apr 16, 2024

function calling support coroutine function

function calling support corouteine function
@canwushuang canwushuang changed the title function calling support corouteine function function calling support coroutine function Apr 16, 2024
@canwushuang
Copy link
Contributor Author

A better way is to add import inspect and use inspect.iscoroutinefunction() as an alternative.
python/cpython#94912

@JelleZijlstra
Copy link
Contributor

Thank you! Yes, let's use the inspect version (https://docs.python.org/3.10/library/inspect.html#inspect.iscoroutinefunction); could you change the PR?

inspect.isawaitable() has better compatibility because it not only applies to coroutine functions but also to other awaitable objects.
inspect.isawaitable() checks if an object can be awaited, while inspect.iscoroutinefunction() checks if a function is defined as a coroutine function. The former inspects objects, and the latter inspects functions. May be ".iscoroutinefunction()" is better in function calling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants