Skip to content

Extend RecursionTracer to handle mutual recursion #1283

@david-yz-liu

Description

@david-yz-liu

Currently the python_ta.debug.RecursionTable context manager only works with a single function_name argument. However, there are cases where we may want to support mutual recursion like

def f(n: int) -> int:
    if n <= 0:
        return 1
    else:
        return 2 + g(n - 1)
    

def g(n: int) -> int:
    if n <= 0:
        return 1
    else:
        return 2 * f(n - 1)

Let's modify RecursionTable to take a list of function names to be able to trace. The table output format will likely need to be updated as well.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions