On Tue, Dec 24, 2019 at 11:34 AM DL Neil via Python-list <python-list@python.org> wrote: > > On 24/12/19 1:04 PM, Chris Angelico wrote: > > File parsing. You read a section header and want to ignore that > > section, so you ignore the next 15 lines. > > (just to be cheeky to @Chris) > > Perhaps better as a Finite State Machine, with one state being 'seeking > section header'. > 1 can we guarantee that the 'magic constant' of 15 will always apply?
That number came from the header itself. Okay, so more commonly this kind of thing is a *byte* count, but I have known some that count lines, or entries, or something else that you'd have a function to grab one of. > 2 presumably the total routine will involve more than identifying a > single header and skipping (only) that section. Of course. But after skipping that section (by ignoring X lines), you go do something else. ChrisA -- https://mail.python.org/mailman/listinfo/python-list