numpy / numpy/numpy

Should np.ma.masked be hashable?

Open
#4,660 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

54 - Needs decision component: numpy.ma
Dominant language
Python
Stars
32.8k
Forks
12.8k
Avg merge
1d 7h
Merged PRs (30d)
197

Description

It seems that in python 2.7 I can do a = {np.ma.masked: 'AAA'} while in python3 this code throws TypeError: unhashable type: 'MaskedConstant' (numpy 1.8. in both cases).

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

Start by reproducing the shown dictionary example with NumPy 1.8 under Python 2.7 and Python 3, then inspect the behavior of np.ma.masked and MaskedConstant. Determine the intended hashability contract and verify the final decision with regression coverage for both interpreter versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.