Myvideo

Guest

Login

Video von Библиотека Python разработчика

Uploaded By: Myvideo
3 views
0
0 votes
0

► Discover Python's advanced features & how to use them to write cleaner and more maintainable code An overview on Python's *args and **kwargs feature for writing functions with a variable number of arguments and/or making some parameters that a function accepts optional. In this tutorial I also demonstrate real world applications and use cases for optional parameters. For example, a design pattern you can use to extend the behavior of a parent class without having to replicate the full signature of its constructor in the child class. In summary, this is how optional function and method parameters work in Python: *args and **kwargs let you write functions with a variable number of arguments in Python. *args collects extra positional arguments as a tuple. **kwargs collects the extra keyword arguments as a dictionary. The actual syntax is * and **. Calling them args and kwargs is just a convention (one you should stick to). To learn how to use the full potential of Python check out “Python Tricks: The Book“ at the link below. FREE COURSE – “5 Thoughts on Mastering Python“ PYTHON TRICKS: THE BOOK SUBSCRIBE TO THIS CHANNEL: * * * ► Python Developer MUGS, T-SHIRTS & MORE: FREE Python Tutorials & News: » Python Tutorials: » Python News on Twitter: @dbader_org » Weekly Tips for Pythonistas: » Subscribe to this channel:

Share with your friends

Link:

Embed:

Video Size:

Custom size:

x

Add to Playlist:

Favorites
My Playlist
Watch Later