Bugs
Repository commit
a0b0f41
Python version (python --version)
Python 3.10.7
Dependencies version (pip freeze)
Not applicable (this is a logical issue, not dependency-related)
Expected behavior
All methods (compress, decompress, and coordinate_map) should handle missing or invalid values consistently.
Either:
All methods raise exceptions (e.g., KeyError, ValueError) for invalid inputs, or
All methods return a defined sentinel value (e.g., -1 or None) to indicate failure.
The chosen behavior should be clearly documented and predictable.
There should be no mix of silent failures and exceptions.
Actual behavior
he methods currently behave inconsistently when given invalid or missing inputs:
compress(80) → returns -1 (silent failure)
coordinate_map[80] → raises KeyError (exception)
decompress(5) → returns -1 (silent failure)
This inconsistent mix of return values and exceptions makes debugging difficult and can lead to unexpected runtime behavior.
Hi, I'll try to resolve this issue.
Please assign this issue to me
Hello @smitrajurkar , Can I work on this issue?
hello @smitrajurkar , please assign me for this
Hi, I’m a beginner and would like to work on this issue. Could you please confirm if I can take it and guide me on where to start?
Thanks!
Analysis The user reports that three methods (compress, coordinate_map, and decompress) return a mix of return values and exceptions for failure:Expected Behavior The expected behavior is to choose one consistent strategy for all methods: Raise Exceptions: All methods should raise exceptions (e.g., KeyError, ValueError) for invalid inputs. OR Return Sentinel Value: All methods should return a defined sentinel value (e.g., -1 or None) to indicate failure. Solution The code needs to be refactored to enforce one of the two strategies (exceptions or sentinel values) consistently across all error-handling logic within the three methods. This change should then be clearly documented.
Thank you for the clarification.
I will refactor compress, coordinate_map, and decompress to use a consistent error-handling strategy by raising exceptions for invalid inputs, and I will update the documentation accordingly.