`Interpreter` and `@v_args` do not mix
See original GitHub issueI have the following bit of code to make my own Interpreter
on a tree:
@lark.v_args(inline=True)
class EvalAST(lark.visitors.Interpreter):
def __init__(self, context):
self.context = context
...
However, when I construct an instance of EvalAST
, I get the following exception:
File "/usr/local/lib/python3.6/dist-packages/lark/visitors.py", line 287, in f
return _f(*args, **kwargs)
TypeError: __init__() missing 1 required positional argument: 'context'
Removing the use of @v_args
fixes the issue… At the cost of not being able to use @v_args
. It seems that it’s not treating my custom __init__
correctly, failing to forward arguments or something.
I am using Lark version 0.8.1.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Variable-Length Arguments in Python with *args and **kwargs
While a function can only have one argument of variable length of each type, we can combine both types of functions in one...
Read more >varargs as input parameter to a function in java 8
Short answer. This doesn't seem possible. · Extend Function interface? Doesn't work either. · Syntax for array creation, helper methods. If you ...
Read more >Eva H Vargas (@evahvargas) / Twitter
Spanish Educational Interpreter & Translator Specialist at OUSD Bilingual ... What do you do when parents don't show up to IEP meetings? ......
Read more >Implementing a medical student interpreter training program ...
All students who decided to take the exam were able to successfully become certified interpreters. Ninety-two percent of participants ...
Read more >"inverse varargs problem", take 1 - C FAQ
A nice problem. Doug Gwyn's suggestion is the right one, for maximum portability, but constrains the form of the called subroutines and also...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My rule of thumb is that for every issue that’s reported, there are users who faced the same problem but decided to just give up, or will face it in the future. So if the request is reasonable, I try to accommodate my users where I can.
Anyway, happy to help 😃
Just tested it out now, and it appears to work. Thanks again!