Python works differently from languages that support passing arguments by reference or by value. Function arguments become local variables assigned to each value that was passed to the function. But this doesn’t prevent you from achieving the same results you’d expect when passing arguments by reference in other languages.
In this course, you learned:
- How Python handles assigning values to variables
- How function arguments are passed by assignment in Python
- Why returning values is a best practice for replicating pass by reference
- How to use attributes, dictionaries, and lists as alternative best practices
For more information on concepts covered in this lesson, you can check out:
- The Walrus Operator: Python 3.8 Assignment Expressions | Real Python Tutorial
- Immutability in Python | Real Python Video Course
- Namespaces and Scope in Python | Real Python Tutorial
- Python Scope & the LEGB Rule: Resolving Names in Your Code | Real Python Tutorial
- Python Constants: Improve Your Code’s Maintainability
- How to Use Type Hints for Multiple Return Types in Python
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.