Python Intermediate: Type Hinting

Pubblicato il: 12 luglio 2021
sul canale di: BitCode
115
10

Welcome to another tutorial in the intermediate series, this tutorial is about type hinting.
Type hinting is literally what the words mean. Type hinting in python is just a way to hint the type of a variable or hint the type of parameter in a function.
You hint the type of the objects you're using.

Without Type Hinting:
def fun(x):
x = x + 1
return x

With Type Hinting:
def fun(x:int) :
x = x +1
return x

Type hints are similar to comments they are ignored when you actually run the code they are ignored, but when using a IDE they can be really useful , when calling the function it can help us with the function parameters or with the variable types and so on.

Keyboard I Use: https://amzn.to/2NgjPFV
(Affiliate Link, Helps the Channel)

Discord Server:
  / discord  


In questa pagina del sito puoi guardare il video online Python Intermediate: Type Hinting della durata di ore minuti seconda in buona qualità , che l'utente ha caricato BitCode 12 luglio 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 115 volte e gli è piaciuto 10 spettatori. Buona visione!