Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to disable anchors and just copy identical objects #57

Open
pxeger opened this issue Aug 22, 2021 · 1 comment
Open

Option to disable anchors and just copy identical objects #57

pxeger opened this issue Aug 22, 2021 · 1 comment

Comments

@pxeger
Copy link

pxeger commented Aug 22, 2021

Currently, if an object containing the same list or dict object twice is dumped, aliases are created:

yaml = YAML(...)
x = [1, 2, 3]
y = [x, x]
yaml.dump(y, ...)

produces

- &id001 [1, 2, 3]
- *id001

It would be nice to have an option to disable this, so the output can be more easily readable, like this instead:

- [1, 2, 3]
- [1, 2, 3]
@smurfix
Copy link
Collaborator

smurfix commented Aug 22, 2021

While this should be possible, it's not as trivial as it seems, since you still need aliases when you dump recursive objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants