Skip to content
Discussion options

You must be logged in to vote

Where do function dunder type definitions come from?

There's unfortunately not a single answer to this question. It depends on which dunders you're talking about. Pyright tends to use definitions from typeshed wherever possible. For example, for functions (as in your example above), it uses the dunders from the function class in builtins.pyi. For modules, classes and functions, pyright's binder implicitly adds certain dunder symbols that are documented to exist but are not declared in typeshed stubs. You can find these by searching for _addImplicitSymbolToCurrentScope in binder.ts. Here's a link.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hmc-cs-mdrissi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants