[New-bugs-announce] [issue30377] Unnecessary complexity in tokenize.py around handling of comments and newlines

Albert-Jan Nijburg report at bugs.python.org
Tue May 16 09:08:09 EDT 2017


New submission from Albert-Jan Nijburg:

While porting tokenize.py to javascript I stumbled upon this. The bit of code that checks if it's a newline or a comment, checks for comment twice. These can be split up, this way the code is a bit more readable. 

https://github.com/python/cpython/blob/master/Lib/tokenize.py#L560

It's not broken, it's just a bit more complex then it has to be.

----------
components: Library (Lib)
messages: 293760
nosy: Albert-Jan Nijburg, meador.inge
priority: normal
severity: normal
status: open
title: Unnecessary complexity in tokenize.py around handling of comments and newlines
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30377>
_______________________________________


More information about the New-bugs-announce mailing list