Weird bahaviour from shlex - line no

2013-09-28 Thread Daniel Stojanov
Can somebody explain this. The line number reported by shlex depends on the previous token. I want to be able to tell if I have just popped the last token on a line. import shlex first = shlex.shlex(word1 word2\nword3) print first.get_token() print first.get_token() print line no,

Re: Weird bahaviour from shlex - line no

2013-09-28 Thread Andreas Perstinger
On 28.09.2013 08:26, Daniel Stojanov wrote: Can somebody explain this. The line number reported by shlex depends on the previous token. I want to be able to tell if I have just popped the last token on a line. [SNIP] second = shlex.shlex(word1 word2,\nword3) Punctuation characters like the

Re: Weird bahaviour from shlex - line no

2013-09-28 Thread Dave Angel
On 28/9/2013 02:26, Daniel Stojanov wrote: Can somebody explain this. The line number reported by shlex depends on the previous token. I want to be able to tell if I have just popped the last token on a line. I agree that it seems weird. However, I don't think you have made clear why it's

Re: Weird bahaviour from shlex - line no

2013-09-28 Thread Peter Otten
Dave Angel wrote: On 28/9/2013 02:26, Daniel Stojanov wrote: Can somebody explain this. The line number reported by shlex depends on the previous token. I want to be able to tell if I have just popped the last token on a line. I agree that it seems weird. However, I don't think you

Re: Weird bahaviour from shlex - line no

2013-09-28 Thread Piet van Oostrum
Peter Otten __pete...@web.de writes: Dave Angel wrote: On 28/9/2013 02:26, Daniel Stojanov wrote: Can somebody explain this. The line number reported by shlex depends on the previous token. I want to be able to tell if I have just popped the last token on a line. [...] The explanation