Facts and myths about Python names and values | Ned Batchelder
The behavior of names and values in Python can be confusing. Like many parts of Python, it has an underlying simplicity that can be hard to discern, especially if you are used to other programming languages. Here I’ll explain how it all works, and present some facts and myths along the way. BTW: I worked this up into a presentation for PyCon 2015: Python Names and Values. Let’s start simple: As in many programming languages, a Python assignment statement associates a symbolic name on the left-hand side with a value on the right-hand side. In Python, we say that names refer to values, or a name is a reference to a value: Now the name “x” refers to the value 23. The next time we use the name x, we’ll get the value 23: Exactly how the name refers to the value isn’t really important. If you’re experienced with the C language, you might like to think of it as a pointer, but if that means nothing to you then don’t worry about it. To help explain what’s going on, I’ll use diagrams. A gray rec
Facts and myths about Python names and values | Ned Batchelder Facts and myths about Python names and values Created 6 July 2013, last updated 26 January 2014 This page is also available in Turkish . The behavior of names and values in Python can be confusing. Like many parts of Python, it has an underlying simplicity that can be hard to discern, especially if you are used to other programming languages. Here I’ll explain how it all works, and present some facts and myths along the way. BTW: I worked this up into a presentation for PyCon 2015: Python Names and Values . Names and values L
Explore this link on the map →related reading
- Variables and Types: OxRSE Trainingtrain.oxrse.uk
- 2.4 Mutable Datacomposingprograms.com
- Variables and Mutability - The Rust Programming Languagedoc.rust-lang.org
- A half-hour to learn Rustfasterthanli.me
- References and Borrowing - The Rust Programming Languagedoc.rust-lang.org
- Programming FAQ — Python 3.14.6 documentationdocs.python.org
- 9. Classes — Python 3.14.6 documentationdocs.python.org
- CSC 151 - Naming values with local bindingseikmeier.sites.grinnell.edu
- What is Ownership? - The Rust Programming Languagedoc.rust-lang.org
- Python Scope and the LEGB Rule: Resolving Names in Your Code – Real Pythonrealpython.com
- Emulating pass-by-value behaviour in Python - Stack Overflowstackoverflow.com
- Destroy All Values: Designing Deinitialization in Programming Languages - Faultloregankra.github.io