Multiple Assignments in Python

Veröffentlicht am: 28 August 2021
auf dem Kanal: mCoding
65,605
3.1k

Chain those equals signs!

Python allows multiple assignments, or chained assignments, to assign multiple variables or expressions at once. This can be a useful tool but it is also a source of confusion when the multiple assignments involve the same name multiple times or when the assignment target is mutable. The assignments are evaluated right hand side first, then left to right, assigning each expression to the target in turn. This differs from many other programming languages and it is also different from the way Pythons assignment expressions (the walrus operator (:=) colon equals) works.

― mCoding with James Murphy (https://mcoding.io)

Source code: https://github.com/mCodingLLC/VideosS...
Assignment statement docs: https://docs.python.org/3/reference/s...
Evaluation order docs: https://docs.python.org/3/reference/e...
Assignment expressions PEP: https://www.python.org/dev/peps/pep-0...

SUPPORT ME ⭐
---------------------------------------------------
Patreon:   / mcoding  
Paypal: https://www.paypal.com/donate/?hosted...
Other donations: https://mcoding.io/donate

Top patrons and donors: Laura M, Jameson, John Martin, Vahnekie, Pieter G, Sigmanificient

BE ACTIVE IN MY COMMUNITY 😄
---------------------------------------------------
Discord:   / discord  
Github: https://github.com/mCodingLLC/
Reddit:   / mcoding  
Facebook:   / james.mcoding  

CHAPTERS
---------------------------------------------------
0:00 Intro
0:49 Multiple assignment example
2:12 Tricky example
4:54 Assignment expressions
6:56 Quiz time


Auf dieser Seite können Sie das Online-Video Multiple Assignments in Python mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer mCoding 28 August 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 65,605 Mal angesehen und es wurde von 3.1 tausend den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!