Title: sorts/radix_sort.py: radix_sort() does not raise exception for negative inputs · Issue #14950 · TheAlgorithms/Python · GitHub
Open Graph Title: sorts/radix_sort.py: radix_sort() does not raise exception for negative inputs · Issue #14950 · TheAlgorithms/Python
X Title: sorts/radix_sort.py: radix_sort() does not raise exception for negative inputs · Issue #14950 · TheAlgorithms/Python
Description: Repository commit 567bb93 Python version (python --version) Python 3.14.2 Dependencies version (pip freeze) contourpy==1.3.3 cycler==0.12.1 dnspython==2.8.0 fonttools==4.62.1 iniconfig==2.3.0 kiwisolver==1.5.0 matplotlib==3.10.8 numpy==2...
Open Graph Description: Repository commit 567bb93 Python version (python --version) Python 3.14.2 Dependencies version (pip freeze) contourpy==1.3.3 cycler==0.12.1 dnspython==2.8.0 fonttools==4.62.1 iniconfig==2.3.0 kiwis...
X Description: Repository commit 567bb93 Python version (python --version) Python 3.14.2 Dependencies version (pip freeze) contourpy==1.3.3 cycler==0.12.1 dnspython==2.8.0 fonttools==4.62.1 iniconfig==2.3.0 kiwis...
Opengraph URL: https://github.com/TheAlgorithms/Python/issues/14950
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"sorts/radix_sort.py: radix_sort() does not raise exception for negative inputs","articleBody":"### Repository commit\n\n567bb935d45af0d089b977c7b5fbfc2c5e569397\n\n### Python version (python --version)\n\nPython 3.14.2\n\n### Dependencies version (pip freeze)\n\ncontourpy==1.3.3\ncycler==0.12.1\ndnspython==2.8.0\nfonttools==4.62.1\niniconfig==2.3.0\nkiwisolver==1.5.0\nmatplotlib==3.10.8\nnumpy==2.4.4\npackaging==26.0\npillow==12.2.0\npluggy==1.6.0\nPygments==2.20.0\npymongo==4.17.0\npyparsing==3.3.2\npytest==9.1.1\npytest-timeout==2.4.0\npython-dateutil==2.9.0.post0\npyzmq==27.1.0\nsix==1.17.0\n\n### Expected behavior\n\nradix_sort() should raise a value error when a negative value is used.\n\nex. radix_sort([1, 3, -2, 4]) should raise ValueError because a negative value will not map to the correct bucket.\n\n### Actual behavior\n\nWhen provided a negative value, radix_sort() proceeds with sorting and returns an incorrectly sorted array.\nEx. radix_sort([1, 3, -2, 4]) returns [1, 3, 4, -2] \n\nPlace [test_radix_sort.py](https://github.com/user-attachments/files/30175030/test_radix_sort.py) in the same directory and run \"pytest test_radix_sort.py\" to replicate.\n\n\u003cimg width=\"836\" height=\"393\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/3fa8dff2-11ba-4569-ad25-9eff9fa46e58\" />\n\nThis is a small bug, but violates the [definition](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md#what-is-an-algorithm) that \"Algorithms should: ... raise Python exceptions (ValueError, etc.) on erroneous input values.\"\n\n### Suggested action\nAdd a check when sorting the list_of_ints into buckets that raises a ValueError if i \u003c 0. I am willing to implement this.","author":{"url":"https://github.com/greemich-bot","@type":"Person","name":"greemich-bot"},"datePublished":"2026-07-20T04:11:50Z","url":"https://github.com/TheAlgorithms/Python/issues/14950"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bda396d2-a1bd-cc17-76f0-55e8ba4c8e98 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 868C:ABEA3:31D44F:41D8D8:6AFBB887 |
| html-safe-nonce | 71f587497005391c8924cb320445e0192e61139dd47d32483dd43e067bd1f4ae |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NjhDOkFCRUEzOjMxRDQ0Rjo0MUQ4RDg6NkFGQkI4ODciLCJ2aXNpdG9yX2lkIjoiOTExNjE5MDM2MDk3ODgzMTQ5NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 44b5343819c2a5fe734fc5f4427b525b3a132e51ee6a8f12609b7c85466ee883 |
| hovercard-subject-tag | issue:4925701718 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/TheAlgorithms/Python/14950/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3998dc43e0ab9ee72e3197c2142425e36b8f60a86ab984776df52c7aef448a4f/TheAlgorithms/Python/issues/14950 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3998dc43e0ab9ee72e3197c2142425e36b8f60a86ab984776df52c7aef448a4f/TheAlgorithms/Python/issues/14950 |
| og:image:alt | Repository commit 567bb93 Python version (python --version) Python 3.14.2 Dependencies version (pip freeze) contourpy==1.3.3 cycler==0.12.1 dnspython==2.8.0 fonttools==4.62.1 iniconfig==2.3.0 kiwis... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | greemich-bot |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2b2ef9c1578c18d8ed27027940544c958743213cf4461659f14d3ccdf51e162c |
| turbo-cache-control | no-preview |
| go-import | github.com/TheAlgorithms/Python git https://github.com/TheAlgorithms/Python.git |
| octolytics-dimension-user_id | 20487725 |
| octolytics-dimension-user_login | TheAlgorithms |
| octolytics-dimension-repository_id | 63476337 |
| octolytics-dimension-repository_nwo | TheAlgorithms/Python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 63476337 |
| octolytics-dimension-repository_network_root_nwo | TheAlgorithms/Python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e4cce0e99cf61481a318ff12c2e8580153a6c7c6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width