6 ms·
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 pub
by javierbg95 10mo 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.
- ndr 10mo agoYes, it is quite surprised they're not allowed. I wonder what's the likely limitation, any ideas?
- ndr 10mo agoFound 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/8f5db70da2b7bbfafc41b55abea44c0a65a807ba/DESIGN.md#:~:text=Nested%20function%20definitions,to%20module%20level. https://github.com/raaidrt/tacopy/blob/8f5db70da2b7bbfafc41b...
- raaid-rt 9mo agoHave some ideas on getting around this - stay tuned...