whisper.py uses assertions rather than exceptions
Bug #514349 reported by
Elliot Murphy
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Graphite |
Fix Released
|
Medium
|
chrismd |
Bug Description
whisper.py makes use of assertions in a way that is not so idiomatic for python. For example whisper.create() uses assert to test for incorrect input. The more pythonic way would be to raise exceptions there and reserve assert for cases which should never happen.
Related branches
lp:~statik/graphite/cleanup-assertions
- chrismd: Approve
-
Diff: 85 lines (+37/-10)1 file modifiedwhisper/whisper.py (+37/-10)
Changed in graphite: | |
status: | Confirmed → Fix Committed |
Changed in graphite: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
You are absolutely right, an explicit ValueError or TypeError would be much better suited in places where I often simply assert. It's an old bad habit that I've mostly grown out of, whisper happens to be pretty old code. I also went through a brief phase in which I disliked vertical whitespace. Fortunately it only lasted a weekend. Unfortunately that was the weekend I wrote whisper.
Picasso had his blue period right? :)