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

List fields don't return None if the tag doesn't exist #63

Closed
jtpavlock opened this issue Oct 16, 2022 · 3 comments · Fixed by #64
Closed

List fields don't return None if the tag doesn't exist #63

jtpavlock opened this issue Oct 16, 2022 · 3 comments · Fixed by #64

Comments

@jtpavlock
Copy link
Contributor

If a list tag does not exist, it returns an empty list rather than None, but if a non-list tag does not exist, None is returned.

I believe non-existent list tags should also return None so that this behavior is consistent.

@sampsyo
Copy link
Member

sampsyo commented Oct 16, 2022

That's an interesting suggestion! Which tags are you thinking of that produce None when the field is missing? We actually try to avoid that in most cases—the idea is to simplify client code so it doesn't need to constantly check the type of every field. For example, I believe artist is '', not None, when the underlying metadata is missing.

This design decision is certainly a trade-off. The simpler client code comes at the cost of not being able to distinguish the existence of tags.

@jtpavlock
Copy link
Contributor Author

Which tags are you thinking of that produce None when the field is missing?

Referencing #38 and #39, I thought this was the desired behavior if a tag is missing altogether.

@sampsyo
Copy link
Member

sampsyo commented Oct 19, 2022

Ah, you're totally right; I was thinking of the old behavior before we started making this change. (And also what we do at the beets layer, which is to coalesce missing values into default values.) In that case, this issue makes sense to me!

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

Successfully merging a pull request may close this issue.

2 participants