[tensor-shapes] Can we just use `*Shape` instead of `*Elements[Shape]`?

Open
#4,968 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python, rust

Research direction

Start by tracing the tensor-shapes handling of Elements, direct tuple types such as tuple[A, B], and IntTuple, then read the linked discussion for the intended constraints. Done means valid tuple types can be splatted directly without Elements, with behavior and tests covering the existing cases.

Written by the indexing model from the issue text.

Description

needs-discussion tensor-shapes

I'm pretty sure that *tuple[A, B] has no meaning today, nor does *T where T: tuple. And similarly for IntTuple.

If that's the case, and we're confident it will continue to be, then Elements might be unnecessary. We can probably just allow the tuple type itself to be splatted directly. That would make code that actually needs such splats quite a bit more compact

Inspired by @TimothyEDawson's observation in https://github.com/facebook/pyrefly/discussions/4807

Dominant language
Rust
Stars
7k
Forks
521
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from facebook/pyrefly

All issues in facebook/pyrefly

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.