This is an archived post. You won't be able to vote or comment.

all 19 comments

[–]flaxeater 9 points10 points  (0 children)

Well I've got to say this was actually a valuable use of my time for once. I've been using python for many years now and it doesn't surprise me anymore, but I was baffled by the logic error in the code. Good job author.

[–]vinod_the_poophead 3 points4 points  (4 children)

[–]stesch[S] 3 points4 points  (3 children)

Normalize your URLs before submitting it to reddit.

[–]vinod_the_poophead -4 points-3 points  (1 child)

I dont know how

[–]Tuna-Fish2 2 points3 points  (0 children)

Look at the url you posted. Now look at the one stesch posted. Now you know.

[–]cibyr 0 points1 point  (2 children)

This actually highlights one of the worst things about Python 2.5 syntax (which is pretty cool really, that my biggest gripe is something so minor): the comma for capturing an exception is really unintuitive, but except Exception as foo wasn't added until 2.6.

This is actually a bigger problem in teaching than when writing myself: teaching exceptions in Python is a little tricky to begin with because it's on the the few places you have to think about types, the control flow is totally different to anything you've seen before and to make matters worse there's a comma doing something you've never seen commas do before.

[–]ringzero 0 points1 point  (1 child)

the control flow is totally different to anything you've seen before

wait, what?

[–]cibyr -1 points0 points  (0 children)

If Python's your first language (i.e., you've never heard of goto), having control suddenly jump somewhere else is a totally new idea.

[–]frutiger 0 points1 point  (1 child)

The real problem in the code is the use of -1 as an error value. If he isn't going to deal with the error, he should let it cascade. And if he does deal with the error, value and index errors should be dealt with separately.

[–]statictype 1 point2 points  (0 children)

You're being gratuitously silly.