Oct-25-2019, 12:48 AM
i'm reading in a series of lines. it might be better to think of this as iterating over an iterator of lines. the lines may be indented just like reading python source. what i would like for a function or class to do is, given that line (not stripped), return the indentation sequence for it. that is not how many spaces it is indented but rather, is the spaces if the text is indented by exactly one space, regardless of the actual syntax in use (disregard syntax). if the next line un-indents to a level previously seen, its index level will be the same as that level. if the next line un-indents to a number of spaces different than seen before, it can return some error value or raise an exception.
example:
example:
start #0 here #0 alpha #1 beta #1 gamma #2 delta #3 epsilon #3 zeta #2 eta #2 theta #2 iota #1 kappa #2 lambda #3 mu #1 nu #0 xi #1 omicron #2 pi #invalid undentationanyone know of such a function or class?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.