Paul McGuire schrieb:
loc = data.index("list") print data[:loc].count("\n")-1 print loc-data[:loc].rindex("\n")-1prints 5,14 I'm sure it's non-optimal, but it *is* an algorithm that does not require keeping track of the start of every line...
Yes, I was thinking of something like this. As long as the line/column are only needed in case of an error (i.e. at most once per script run), I consider this more performant than keeping track of line/column for every token.
Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison! (Coluche) -- http://mail.python.org/mailman/listinfo/python-list
