Problem
The Region class and CacheMiss exception in malariagen_data/util.py lack informative string representations for debugging.
-
Region has a __str__ method (e.g., "2L:100,000-200,000") but no __repr__. When a Region object appears inside a list, dict, or is inspected interactively in Python/Jupyter notebooks, you get the unhelpful default: <malariagen_data.util.Region object at 0x7f...>.
-
CacheMiss is a bare Exception subclass (class CacheMiss(Exception): pass) with no default message and no __repr__. When caught and printed during debugging, it shows as CacheMiss() with no context.
Evidence
In malariagen_data/util.py:
Region class (line ~542): has __str__ but no __repr__
CacheMiss class (line ~906): class CacheMiss(Exception): pass
Proposed Fix
-
Add __repr__ to Region that returns a valid Python constructor-style string, e.g.:
Region('2L', 100000, 200000) → repr shows Region('2L', 100000, 200000)
-
Add __repr__ (and optional default message) to CacheMiss for clearer output during debugging.
Impact
Better debugging experience for both users and developers. Small, targeted change with large UX improvement.
Problem
The
Regionclass andCacheMissexception inmalariagen_data/util.pylack informative string representations for debugging.Regionhas a__str__method (e.g.,"2L:100,000-200,000") but no__repr__. When aRegionobject appears inside a list, dict, or is inspected interactively in Python/Jupyter notebooks, you get the unhelpful default:<malariagen_data.util.Region object at 0x7f...>.CacheMissis a bareExceptionsubclass (class CacheMiss(Exception): pass) with no default message and no__repr__. When caught and printed during debugging, it shows asCacheMiss()with no context.Evidence
In
malariagen_data/util.py:Regionclass (line ~542): has__str__but no__repr__CacheMissclass (line ~906):class CacheMiss(Exception): passProposed Fix
Add
__repr__toRegionthat returns a valid Python constructor-style string, e.g.:Region('2L', 100000, 200000)→ repr showsRegion('2L', 100000, 200000)Add
__repr__(and optional default message) toCacheMissfor clearer output during debugging.Impact
Better debugging experience for both users and developers. Small, targeted change with large UX improvement.