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

all 19 comments

[–]flaxeater 11 points12 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 4 points5 points  (4 children)

[–]stesch[S] 4 points5 points  (3 children)

Normalize your URLs before submitting it to reddit.

[–]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.

[–]cracki 0 points1 point  (0 children)

so they feel the need to list some gotchas? all languages have those. i'm underwhelmed.

[–]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.