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

chore(refactor): handle 0-length args in highest_precedence_shape() #9333

Closed
wants to merge 1 commit into from

Conversation

NickCrews
Copy link
Contributor

moving towards #8666

@@ -16,6 +17,9 @@

@public
def highest_precedence_shape(nodes):
nodes = tuple(nodes)
if len(nodes) == 0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if len(nodes) == 0:
if not nodes:

@cpcloud
Copy link
Member

cpcloud commented Jun 7, 2024

What's the rationale for the general case of no arguments being scalar versus the empty array case which seems clear that it should be.

This seems like it should raise an exception in the general case and we should specialize the semantics in cases where it makes sense.

@NickCrews
Copy link
Contributor Author

hmm I think you are right, we want to be explicit and have users be resonsible for dealing with this edge case. Imagine there is some case we haven't found that causes a 0-length arg. With this change, that would now give scalar, even if that might be silently wrong. I think we would rather have that undiscovered situation do a hard error, then get a bug report about it.

slightly related as I explored this more: #9334

@NickCrews NickCrews closed this Jun 7, 2024
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 this pull request may close these issues.

2 participants