Python - Functions with Optional Arguments

Опубликовано: 10 Июнь 2021
на канале: 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  


Смотрите видео Python - Functions with Optional Arguments онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь codevev 10 Июнь 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 502 раз и оно понравилось 11 людям.