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

Change special return value for REMOVE #96

Closed
LWprogramming opened this issue Jun 8, 2020 · 3 comments
Closed

Change special return value for REMOVE #96

LWprogramming opened this issue Jun 8, 2020 · 3 comments

Comments

@LWprogramming
Copy link

The visitor.py file sets the special value REMOVE to Ellipsis. However, this causes trouble with type-hinting functions that return REMOVE. Could we create a separate value rather than using Ellipsis? See the issues linked here, where the consensus is in favor of not using the Ellipsis constant. Thank you!

@Cito
Copy link
Member

Cito commented Jun 8, 2020

Maybe we should create an enum VisitorAction containing these four special values, and set REMOVE to VisitorAction.REMOVE etc. Then adding type hints would be even easier. For backward compatibility, the visitor could still recognize the other special values like Ellipsis.

Would that solve the problem?

@LWprogramming
Copy link
Author

That would work! Arguably it would work even better because we wouldn't need to update the type-hint every time we have a visitor function return a different special value.

@Cito
Copy link
Member

Cito commented Jun 26, 2020

I have implemented this in the master branch now.

@Cito Cito closed this as completed Jul 5, 2020
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