On 2011-06-06, Ian Kelly <ian.g.ke...@gmail.com> wrote: > Fair enough, although if you ask me the + 1 is just as magical > as the + 7 (it's still the length of the string that you're > searching for). Also, re-finding the opening ' still repeats > information.
Heh, true. I doesn't really repeat information, though, as in my version there could be intervening garbage after the TABLE=, which probably isn't desirable. > The main thing I wanted to fix was that the second .index() > call had the possibility of raising an unhandled ValueError. > There are really two things we have to search for in the line, > either of which could be missing, and catching them both with > the same except: clause feels better to me than checking both > of them for -1. I thought an unhandled ValueError was a good idea in that case. I knew that TABLE= may not exist, but I assumed if it did, that the quotes are supposed to be there. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list