DEV Community

nixcodes
nixcodes

Posted on

FastAPI Day 1: Type Hints

Hey there πŸ‘‹! Today I am starting my day one with FastAPI programming. I have very little knowledge about Python and Django so, I think this is the good time for me to start.

Today I learnt about Type Hints,
Type Hints are nothing but defining the data types of the variables during the declaration. So that we will have required suggestions (Ctrl+Space) from the IDE like VS Code, Sublime text, etc.

suggestions when declaring variable without types hints:
Image description

suggestions when declaring variable with types hints:
Image description

Type Hints can be used for standard data types like int, str, float, bool, byte. In order to use the generic data types like dict, list, tuple, set we have to import typing module in our code.

from typing import List, Set, Tuple, Dict
Enter fullscreen mode Exit fullscreen mode

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more