ramonhagenaars / nptyping

💡 Type hints for Numpy and Pandas
MIT License
588 stars 29 forks source link

Named dimensions in type-hint shapes #24

Closed petered closed 4 years ago

petered commented 4 years ago

I find it would be really nice to assign names to dimensions, e.g. NDArray[('H', 'W', 3), UInt8] ... and a more compact option: NDArray['H,W,3', UInt8]. This can serve two purposes:

  1. Hint at the meaning of the dimensions
  1. Specify shape constraints across arguments:
ramonhagenaars commented 4 years ago

Hi @petered

This feature has been requested before and is "on my radar". Check out my 2nd comment in #12 which explains how I envision this ability. If you have anything to add or comment to that, please continue the discussion there.