Python icon indicating copy to clipboard operation
Python copied to clipboard

Bugs

Open smitrajurkar opened this issue 4 months ago • 7 comments

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.

smitrajurkar avatar Oct 15 '25 05:10 smitrajurkar

Hi, I'll try to resolve this issue.

superdev326 avatar Oct 15 '25 07:10 superdev326

Please assign this issue to me

JainRamyak avatar Oct 15 '25 09:10 JainRamyak

Hello @smitrajurkar , Can I work on this issue?

adityanaulakha avatar Oct 19 '25 16:10 adityanaulakha

hello @smitrajurkar , please assign me for this

mrstrange1708 avatar Oct 21 '25 07:10 mrstrange1708

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!

sneha-sharma17 avatar Dec 14 '25 10:12 sneha-sharma17

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.

Asukasuk avatar Dec 14 '25 11:12 Asukasuk

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.

sneha-sharma17 avatar Dec 14 '25 12:12 sneha-sharma17