Skip to content

Add support for nonempty variadic axes via + (Issue #378)#395

Open
pdcook wants to merge 1 commit into
patrick-kidger:mainfrom
pdcook:main
Open

Add support for nonempty variadic axes via + (Issue #378)#395
pdcook wants to merge 1 commit into
patrick-kidger:mainfrom
pdcook:main

Conversation

@pdcook

@pdcook pdcook commented Jul 6, 2026

Copy link
Copy Markdown

Addresses #378

Can now require that a named or anonymous axes have at least one matching axis by prepending +, as a complement to the zero or more *.

Examples:

Before

def f(x: Float[Array, "batch feature0 *features"]): pass

Now

def f(x: Float[Array, "batch +features"]): pass

Added both positive and negative tests for this in tests/test_array.py.


(Unrelated) The tests test_numpy_arraylike_work_around_pep484_badness and test_union_of_arraylike did not pass on the main branch even before any changes. This could be a consequence of my environment, but I followed the contributing guide and used uv so I'm unsure of where I could've diverged.

@patrick-kidger

Copy link
Copy Markdown
Owner

Thanks for this! I'm afraid I think I prefer to keep this as-is though. The jaxtyping grammar (and implementation!) is already pretty complicated, so I think I'd prefer to keep it simple.

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