Comment by javierbg95
10 hours ago
Really cool project, fairly succinct and to the point :)
I would love to see support for arbitrarily nested functions, as it is common to wrap these into a public API function without the iteration parameters.
10 hours ago
Really cool project, fairly succinct and to the point :)
I would love to see support for arbitrarily nested functions, as it is common to wrap these into a public API function without the iteration parameters.
Yes, it is quite surprised they're not allowed. I wonder what's the likely limitation, any ideas?
Found out
> Nested function definitions with @tacopy decorators are not supported. Functions decorated with @tacopy must be defined at module level. This constraint exists because inspect.getsource() on nested functions returns the source of the entire enclosing function, making it impossible to reliably extract and transform just the nested function's code. The decorator detects nested functions by checking for '<locals>' in the function's __qualname__ attribute and raises a clear error message instructing users to extract the function to module level.
https://github.com/raaidrt/tacopy/blob/8f5db70da2b7bbfafc41b...