Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save return value of self.args() in Command #5

Closed
SvenChmie opened this issue May 7, 2014 · 3 comments
Closed

Save return value of self.args() in Command #5

SvenChmie opened this issue May 7, 2014 · 3 comments

Comments

@SvenChmie
Copy link
Contributor

When using the autocomplete function in the console for dynamic arguments, self.args() is called 8 (!) times for each completion. That might not be a big issue when it just returns a list, but once the functions becomes more complex it adds a lot of overhead.
The function could be called once and the return value stored locally.

@SvenChmie
Copy link
Contributor Author

Ok, it seems to be only partly the console's fault. Making only one call to args() can decrease the number of times args is called to 3. Those three calls result from the readline module calling the complete() function three times. No idea why it does that...

@italorossi
Copy link
Owner

This is how readline works.

It'll ask for arguments until None is returned, so if you have 3 dynamic arguments, args() will be called 4 times.

@SvenChmie
Copy link
Contributor Author

Mh, but it seems kinda silly to me then that args() returns a list with all arguments every time..
Maybe I'm missing something here.
Anyways, I moved the computation logic away front he args() function, that already helped a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants