Skip to content

Avoid ambiguity in graphene.Mutation docstring [documentation]#1381

Merged
erikwrede merged 1 commit into
graphql-python:masterfrom
belkka:patch-1
Aug 13, 2022
Merged

Avoid ambiguity in graphene.Mutation docstring [documentation]#1381
erikwrede merged 1 commit into
graphql-python:masterfrom
belkka:patch-1

Conversation

@belkka
Copy link
Copy Markdown
Contributor

@belkka belkka commented Oct 11, 2021

The code example in docstring starts with from graphene import Mutation and defines a class Mutation later. This definition would shadow previously imported name and (which is more important) confuses a reader about usage of this class — one need to keep in mind that previous usage of Mutation is imported from graphene and have not been overridden yet.

This PR changes an "import-from" statement to an "import" statement, so graphene.Mutation is referred explicitly. This approach seems to be consistent with other code examples in the docs (e. g. see https://docs.graphene-python.org/en/v2.1.9/types/mutations/).

Another option is to change name of example class Mutation to something more explicit (maybe SchemaMutation or RootMutation), but I'm not sure what name to choose.

Only docstring is updated, no code changes.

The code example in docstring starts with `from graphene import Mutation` and defines a `class Mutation` later. This definition would shadow previously imported name and (which is more important) confuses a reader about usage of this class — one need to keep in mind that previous usage of `Mutation` is imported from graphene and have not been overridden yet.

This PR changes an import-from statement to an import statement, so `graphene.Mutation` is used explicitly. This approach is consistent with other code examples in docs (e. g. https://docs.graphene-python.org/en/v2.1.9/types/mutations/).

Another option is to change name of example class Mutation to something more clear (maybe SchemaMutation or RootMutation), but I'm not sure what name to choose.

Only docstring is updated, no code changes.
@belkka belkka changed the title Avoid ambiguity in graphene.Mutation docstring Avoid ambiguity in graphene.Mutation docstring [documentation] Dec 15, 2021
Copy link
Copy Markdown

@DarknessRdg DarknessRdg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me 😄

Copy link
Copy Markdown
Member

@erikwrede erikwrede left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@erikwrede erikwrede merged commit 97abb9d into graphql-python:master Aug 13, 2022
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

Successfully merging this pull request may close these issues.

3 participants