This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients eric.snow, takluyver, terry.reedy
Date 2014-02-18.01:49:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1392688192.36.0.146256290703.issue16224@psf.upfronthosting.co.za>
In-reply-to
Content
While I am closing this as a duplicate, I will use some of your patch, including one test, and credit you as well.

Switching from 5-tuples to 2-tuples, as in one of your test cases, is not currently a supported use case,  Compat currently re-iterates the entire token list and that does not work if some tokens have already been processed. While iter(iterable) makes your toy example pass, switching still does not work because of the problem of initializing compat.

   indents = []
This could only work with switching by making it a instance attribute which is also updated in the 5-tuple case. It is needed in tokenize also to support tab indents (#20383) but would only need to be an attribute instead of a local to support switching.
 
    startline = token[0] in (NEWLINE, NL) (my replacement for 3 lines)
This is odd as the the file starts at the start of a line whether or not the first token is \n. On the other hand, the initial value of startline is irrelevant as long as it has some value because it is irrelevant until there has been an indent. It would also have to become an attribute to support switching and then it would be relevant since indents might not be initially empty. But I do not currently see the need for a tuple length switching feature.

    prevstring = False
This does not matter even if wrong since it only means adding a space.
History
Date User Action Args
2014-02-18 01:49:52terry.reedysetrecipients: + terry.reedy, eric.snow, takluyver
2014-02-18 01:49:52terry.reedysetmessageid: <1392688192.36.0.146256290703.issue16224@psf.upfronthosting.co.za>
2014-02-18 01:49:52terry.reedylinkissue16224 messages
2014-02-18 01:49:50terry.reedycreate