This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author JelleZijlstra
Recipients JelleZijlstra, Ruishi, lys.nikolaou, pablogsal
Date 2022-03-11.04:09:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1646971758.29.0.315506426441.issue46980@roundup.psfhosted.org>
In-reply-to
Content
This is the right place to file an issue.

Your code is incorrect; it will find only top-level functions. Functions within an `if` statement will be nested inside an `ast.If` node. To find all functions in a file, you'll need to recurse into nested nodes. For example, you could use `ast.walk`, an `ast.NodeVisitor`, or manually check for nodes like `ast.If`. Which one is best depends on your needs. For example, the first two will also find methods in classes. The ast module documentation has more information.
History
Date User Action Args
2022-03-11 04:09:18JelleZijlstrasetrecipients: + JelleZijlstra, lys.nikolaou, pablogsal, Ruishi
2022-03-11 04:09:18JelleZijlstrasetmessageid: <1646971758.29.0.315506426441.issue46980@roundup.psfhosted.org>
2022-03-11 04:09:18JelleZijlstralinkissue46980 messages
2022-03-11 04:09:18JelleZijlstracreate