don’t return dicts
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 779
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 27
Description
e.g pp.filter_genes_dispersion returns a dict with known keys. if you know the keys, this means you should return an object where you can use attribute access instead. usually the pythonic thing to do in this case is to return a namedtuple.
in this case though, we have
>>> {k: v.shape for k, v in filter_result.items()}
{'dispersions': (173351,),
'dispersions_norm': (173351,),
'gene_filter': (173351,),
'means': (173351,)}
which is a perfect case for a recarray.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at pp.filter_genes_dispersion and inspect how its dict result and the listed keys are consumed by callers. Determine whether a recarray preserves the current values and access patterns, then update the relevant tests or add coverage for the returned fields; done means the function no longer returns a dict and its consumers still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- bioinformatics, data
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100