Skip to content
This repository was archived by the owner on Dec 8, 2020. It is now read-only.
This repository was archived by the owner on Dec 8, 2020. It is now read-only.

Use Python 3.6 and Use Type Hinting #316

@mikaeilorfanian

Description

@mikaeilorfanian

I noticed docstrings in the code that duplicate the "type hinting" feature of Python 3.5 and higher.
Below is an example of how type hinting can produce clean and easy-to-read code:

# current version
def get_object(self, queryset=None):
       """
       Get page for specified language
       :param queryset: current queryset
       :type queryset: QuerySet
       :return: instance of Page
       :rtype: Page
       """ 

# after using type hinting
from django.db.models.query import QuerySet

from .models import Page

def get_object(self, queryset=None: QuerySet) -> Page:
     pass

Using type hinting also allows us to use static code analyzers which will help us produce less buggy code.

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