Skip to content

Change special return value for REMOVE #96

Closed
@LWprogramming

Description

@LWprogramming

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!

Activity

Cito

Cito commented on Jun 8, 2020

@Cito
Member

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

LWprogramming commented on Jun 8, 2020

@LWprogramming
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

Cito commented on Jun 26, 2020

@Cito
Member

I have implemented this in the master branch now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Change special return value for REMOVE · Issue #96 · graphql-python/graphql-core