Tracking page for documentation and example code Style Guide discussion.
Elements discussed and decided:
Example code and snippets should always be copy/paste complete as running code, unless it's a one-liner or short explanatory snippet for which the context is very (very) clear.
Use explicit imports. from graphene import ...
rather than import graphene
.
Use class arguments instead of class Meta
.
Example:
Instead of:
class Human(graphene.ObjectType):
class Meta:
interfaces = (Character, )
starships = graphene.List(Starship)
home_planet = graphene.String()
Use:
class Human(graphene.ObjectType, interfaces = (Character, )):
starships = graphene.List(Starship)
home_planet = graphene.String()
Use f-strings in place of .format(...)
.
Open for discussion:
Using root
instead of self
or _
in resolver definitions.
@staticmethod
?