So I finished some time ago the first assignment in Numerical Analysis. Ahh, such a joyous occasion. Why you ask? Well, because I wrote the programming assignments in Python, and not some annoying made-up pseudo-code language. I know, I know, I should use Matlab, Maple or Mathematica… but well, so far I’m doing fine with Python and numpy. Besides, finally I’m required to do formally what I did informally in the homework for calculus (check out limits in Python to verify my calculations).

While doing the homework, I thought of one small utility function that will never make it. I found myself doing (x)range(n-1,-1,-1), or maybe reversed(range(n))… the first is ugly, and the second is (relatively) slow and takes memory. It would have been nice to have something like reverse_range(n) that will do just that. I’ve happened upon that use only a few times so far, so it’s really not that important. Now I wonder, what should the ‘policy’ be? To write those functions and encourage their use, or the other way around?

What do you think?

## Leave a Reply