Python Function Argument Unpacking Tutorial (* and ** Operators)

Publié le: 17 janvier 2017
sur la chaîne: Real Python
49,177
1.2k

https://dbader.org/python-tricks ► Master advanced features in Python with easy to follow code examples

A really cool but slightly arcane feature is the ability to “unpack” function arguments from sequences and dictionaries with the * and ** operators. These are sometimes also called "splat" operators.

They're most frequently used in Python function definitions along with the *args and **kwargs pattern.

Besides the * operator for unpacking sequences like tuples, lists, and generators into positional arguments there’s also the ** operator for unpacking keyword arguments from dictionaries.

In this video I'll give you an introduction to function argument unpacking in Python with a few straightforward examples.

FREE COURSE – "5 Thoughts on Mastering Python" https://dbader.org/python-mastery
PYTHON TRICKS: THE BOOK https://dbader.org/pytricks-book

SUBSCRIBE TO THIS CHANNEL: https://dbader.org/youtube

* *

► Python Developer MUGS, T-SHIRTS & MORE: https://nerdlettering.com

FREE Python Tutorials & News:
» Python Tutorials: https://dbader.org
» Python News on Twitter:   / @dbader_org  
» Weekly Tips for Pythonistas: https://dbader.org/newsletter
» Subscribe to this channel: https://dbader.org/youtube


Sur cette page du site, vous pouvez voir la vidéo en ligne Python Function Argument Unpacking Tutorial (* and ** Operators) durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Real Python 17 janvier 2017, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 49,177 fois et il a aimé 1.2 mille téléspectateurs. Bon visionnage!