numpy / numpy/numtype

`same_kind` casting type-aliases

Open
#551 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

_numtype topic: NEP 50
Dominant language
Python
Stars
79
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Currently, only the safe (NEP 50) casting rules are implemented (as _numtype type-aliases). For the sake of completeness, the same-kind should also have similar type-aliases.

casting = 'safe'

b1  ->  b1  u1  u2  u4  u8  i1  i2  i4  i8  m8  f2  f4  f8  c8 c16  S   U   T   V   O     
u1  ->      u1  u2  u4  u8      i2  i4  i8  m8  f2  f4  f8  c8 c16  S   U   T   V   O     
u2  ->          u2  u4  u8          i4  i8  m8      f4  f8  c8 c16  S   U   T   V   O     
u4  ->              u4  u8              i8  m8          f8     c16  S   U   T   V   O     
u8  ->                  u8                              f8     c16  S   U   T   V   O     
i1  ->                      i1  i2  i4  i8  m8  f2  f4  f8  c8 c16  S   U   T   V   O     
i2  ->                          i2  i4  i8  m8      f4  f8  c8 c16  S   U   T   V   O     
i4  ->                              i4  i8  m8          f8     c16  S   U   T   V   O     
i8  ->                                  i8  m8          f8     c16  S   U   T   V   O     
m8  ->                                      m8                              T   V   O     
f2  ->                                          f2  f4  f8  c8 c16  S   U   T   V   O     
f4  ->                                              f4  f8  c8 c16  S   U   T   V   O     
f8  ->                                                  f8     c16  S   U   T   V   O     
c8  ->                                                      c8 c16  S   U   T   V   O     
c16 ->                                                         c16  S   U   T   V   O     
S   ->                                                              S   U       V   O     
U   ->                                                                  U       V   O     
T   ->                                                                      T       O     
V   ->                                                                          V   O     
O   ->                                                                              O     
M8  ->                                                                      T   V   O   M8

casting = 'same_kind'

b1  ->  b1  u1  u2  u4  u8  i1  i2  i4  i8  m8  f2  f4  f8  c8 c16  S   U   T   V   O     
u1  ->      u1  u2  u4  u8  i1  i2  i4  i8  m8  f2  f4  f8  c8 c16  S   U   T   V   O     
u2  ->      u1  u2  u4  u8  i1  i2  i4  i8  m8  f2  f4  f8  c8 c16  S   U   T   V   O     
u4  ->      u1  u2  u4  u8  i1  i2  i4  i8  m8  f2  f4  f8  c8 c16  S   U   T   V   O     
u8  ->      u1  u2  u4  u8  i1  i2  i4  i8  m8  f2  f4  f8  c8 c16  S   U   T   V   O     
i1  ->                      i1  i2  i4  i8  m8  f2  f4  f8  c8 c16  S   U   T   V   O     
i2  ->                      i1  i2  i4  i8  m8  f2  f4  f8  c8 c16  S   U   T   V   O     
i4  ->                      i1  i2  i4  i8  m8  f2  f4  f8  c8 c16  S   U   T   V   O     
i8  ->                      i1  i2  i4  i8  m8  f2  f4  f8  c8 c16  S   U   T   V   O     
m8  ->                                      m8                              T   V   O     
f2  ->                                          f2  f4  f8  c8 c16  S   U   T   V   O     
f4  ->                                          f2  f4  f8  c8 c16  S   U   T   V   O     
f8  ->                                          f2  f4  f8  c8 c16  S   U   T   V   O     
c8  ->                                                      c8 c16  S   U   T   V   O     
c16 ->                                                      c8 c16  S   U   T   V   O     
S   ->                                                              S   U   T   V   O     
U   ->                                                                  U   T   V   O     
T   ->  b1                                                          S   U   T   V   O     
V   ->                                                                      T   V   O     
O   ->                                                                              O     
M8  ->                                                                      T   V   O   M8

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.

Research direction

The issue names no files or tests. Start by locating the existing _numtype aliases that implement the casting='safe' rules, then compare them with the requested same_kind table. Done means equivalent same-kind type-aliases are implemented and their behavior is verified against the table.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.