What documentation says is that when you have a local x
variable and do locals()['x'] = 42
, then x
may still point to the old object.
def foo():
x = 0xABCD
locals()['x'] = 42
print(x)
foo()
More Related Contents:
- How does exec work with locals?
- Python: load variables in a dict into namespace
- What does __all__ mean in Python?
- How can I compare two lists in python and return matches
- ImageMagick not authorized to convert PDF to an image
- Aren’t Python strings immutable? Then why does a + ” ” + b work?
- What is the best way to compare floats for almost-equality in Python?
- Why does on_message stop commands from working?
- Pandas convert a column of list to dummies
- Python: count repeated elements in the list [duplicate]
- Python regular expressions – how to capture multiple groups from a wildcard expression?
- Use and meaning of “in” in an if statement?
- Python requests.exceptions.SSLError: EOF occurred in violation of protocol
- Convert Bytes to Floating Point Numbers?
- python assign values to list elements in loop
- Missing data, insert rows in Pandas and fill with NAN
- Python: Sharing global variables between modules and classes therein
- Python REPL tab completion on MacOS
- Duplicate each member in a list [duplicate]
- How do I use cache_clear() on python @functools.lru_cache
- How can I update a .yml file, ignoring preexisting Jinja syntax, using Python?
- How to show PIL images on the screen?
- How to merge csv files with different headers but same data on condition
- Python representation for a set of non-overlapping integer ranges
- Cannot open “.mp4” video files using OpenCV 2.4.3, Python 2.7 in Windows 7 machine
- Is the order of a Python dictionary guaranteed over iterations?
- Why and how are Python functions hashable?
- Vectorizing `numpy.random.choice` for given 2D array of probabilities along an axis
- Run process with realtime output to a Tkinter GUI
- Loading model with custom loss + keras