bcholmes: (Default)
[personal profile] bcholmes

Some time ago, someone I know was showing me some Python code, trying to convince me that I should give a damn about Python. One of the things I found a little off-putting was Python's use of exceptions. Like this:

    try:
      for blah in something.getBlahs():
        if ...someCondition...:
          raise Found
    except Found:
      ...

I found it quite odd that someone would use an exception in this case, given that, y'know, it's not really an exceptional case. To be honest, I've never been too fond of exceptions, thinking them pretty much the equivalent of a goto. Generally, I reserve exceptions for cases that are real programming errors, or infrastructure failures. That's exceptional.

I think this article articulates a lot of what bothers me with exceptions: that, often, a piece of code that has considered the impact of exceptions is indistinguishable from a piece of code that hasn't considered the impact of exceptions.

That's a real maintainability problem, y'know. If you can't rely on the eyes of another programmer to see a particular problem, then you've made the problem harder to adequately manage. This article by "Joel on Software" really addresses this idea well.

This account has disabled anonymous posting.
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

Profile

bcholmes: (Default)
BC Holmes

February 2025

S M T W T F S
      1
2345678
9101112131415
16171819202122
2324252627 28 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Powered by Dreamwidth Studios