question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Interpreter` and `@v_args` do not mix

See original GitHub issue

I 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:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
erezshcommented, Feb 10, 2020

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 😃

0reactions
iconmaster5326commented, Feb 10, 2020

Just tested it out now, and it appears to work. Thanks again!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found