Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Pass by Reference in Python: Best Practices (Summary)

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:

Download

Sample Code (.zip)

14.3 KB

Download

Course Slides (.pdf)

1.9 MB

Become a Member to join the conversation.