Python - Functions with Optional Arguments

Published: 10 June 2021
on channel: codevev
502
11

#Python #Shorts

It is somewhat common to have functions that have arguments that are optional. To create such a function, your arguments need default values. To achieve that, just set the default value right in the function definition. Be careful though, optional arguments MUST appear after all other arguments. And lastly, don't ever use mutable types, such as lists, as default arguments. Use None instead.
-------------------------------------------------------------------------------------
Links:
Blog: https://evgenyurubkov.com
Twitter:   / evgenyurubkov  
Instagram:   / evgenyurubkov  
Youtube:    / @codevev  


On this page of the site you can watch the video online Python - Functions with Optional Arguments with a duration of hours minute second in good quality, which was uploaded by the user codevev 10 June 2021, share the link with friends and acquaintances, this video has already been watched 502 times on youtube and it was liked by 11 viewers. Enjoy your viewing!