Possibility and Probability

Python, AI, and other fun stuff

6/15/2004

Simple errors

I like python a lot, but last night its ease of use bit me again. I had a variable called keypress that was ment to be the users input. I had written the function it was in a few weeks ago so I hadn't really used it yet. Last night when I tried to use it I kept running into a problem. keypress didn't seem to have a value, even through I had just pressed a key.

Since my input is being handled by curses (and I am still new to curses) I started my debugging efforts there. After about 5 minutes or so of getting now where I looked very closely at that input line. Specifically I looked at the left side of the assignment and saw that keypress had been spelled kepyress. Needless to say I was not a happy camper.

And it was kind of funny, I was upset that I never got a warning about an unused variable. Why is that funny? I normally ignore those types of warnings (in other languages). But if I had seen that last night it would have saved me some time.

At any rate, the whole incident highlighted one thing that I don't like about python, the whole strong vs. weak typing argument. I went and checked on the web and found PyChecker which is a tool for checking python source code for common bugs. It looks like a step in the right direction, I think I will be trying it out tonight.

Comment on this post [ so far] ... more like this: [python]