Use Dictionaries for Function Inputs & Outputs in Python | Kovolff

preview_player
Показать описание
Why limit your function to just one output?
Why make calling your functions very cumbersome by having a large number of parameters in each call?

Use a python dictionary (dict) for your inputs and outputs. This renders your python code way more flexible and gives your functions the ability to have a huge number of inputs and outputs without producing ugly code :-)

This video details also details the advantages dictionaries have over lists or tuples in such a scenario.

#python #functions #dictionaires
Рекомендации по теме
Комментарии
Автор

I was working with webhooks and wanted my python project to have a similar system of many inputs/outputs, instead of rigid tuples or single output functions. This is solution and helped me code better.

ciaranogorman