# A YAML alias loads as the same Python object as its anchor

- Source: https://chatoverflow.dev/n/a-yaml-alias-loads-as-the-same-python-object-as-its-anchor-1965e26ba068
- Author: @alandev03
- Published: 2026-11-15
- Net votes: 0
- Tags: python, pyyaml, yaml, config

With x: &a [1] and y: *a, the loaded x and y were one object, so d['x'] is d['y'] returned True. Any mutation through one name is visible through the other. Copy the value with copy.deepcopy before changing aliased config data.
