[issue25579] def is not a keyword with tokenize.py

2015-11-12 Thread Yury Selivanov
Yury Selivanov added the comment: Stéphane, sorry for not replying earlier, emails from bugs.python.org sometimes go to spam. [TokenInfo(type=55 (ASYNC), string='async', start=(1, 0), end=(1, 5), line='async def foo(): pass'), TokenInfo(type=1 (NAME), string='def', start=(1, 6), end=(1, 9), l

[issue25579] def is not a keyword with tokenize.py

2015-11-07 Thread Emanuel Barry
Emanuel Barry added the comment: He probably mistook this for #25179 -- nosy: +ebarry ___ Python tracker ___ ___ Python-bugs-list mail

[issue25579] def is not a keyword with tokenize.py

2015-11-07 Thread Eric V. Smith
Eric V. Smith added the comment: Oops, wrong issue. Ignore my last comment. I shouldn't do two things at once. -- ___ Python tracker ___ _

[issue25579] def is not a keyword with tokenize.py

2015-11-07 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: ?? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.or

[issue25579] def is not a keyword with tokenize.py

2015-11-07 Thread Eric V. Smith
Eric V. Smith added the comment: It does not currently work, because the docstring logic looks for a string, not an expression. And an f-string is an expression. It would require changing the compiler to evaluate the f-string expression. -- ___ Pyth

[issue25579] def is not a keyword with tokenize.py

2015-11-07 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: how to know if it's an issue or not? we can ask to Yury -- nosy: +yselivanov ___ Python tracker ___ ___

[issue25579] def is not a keyword with tokenize.py

2015-11-07 Thread Eric V. Smith
Eric V. Smith added the comment: I think the error here is that tokenize returns type=ASYNC for 'async', instead of type=NAME. -- nosy: +eric.smith ___ Python tracker ___ __

[issue25579] def is not a keyword with tokenize.py

2015-11-07 Thread SilentGhost
SilentGhost added the comment: Perhaps, my example wasn't as self-explanatory as I hoped. def is not DEF in the token list, because there isn't such a token DEF, as there isn't a token PASS or a token for any other keyword. The fact that there is an ASYNC and AWAIT tokens is something complete

[issue25579] def is not a keyword with tokenize.py

2015-11-07 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: why do you close it ? def is not a keyword and it's a problem, how do you define a function is def is not a keyword. async is not a keyword but if you used it before 'def', async will become a keyword. have you checked the output from the tokenizer ? in th

[issue25579] def is not a keyword with tokenize.py

2015-11-07 Thread SilentGhost
SilentGhost added the comment: >>> keyword.iskeyword('pass') True There doesn't seem anything particular about def, none of the keywords have "keyword" type, because there doesn't seem to be one: https://docs.python.org/3.6/library/token.html -- nosy: +SilentGhost resolution: -> not

[issue25579] def is not a keyword with tokenize.py

2015-11-07 Thread Stéphane Wirtel
New submission from Stéphane Wirtel: For tokenize.py, 'def' is not a keyword but just a simple identifier. >>> tokens = tokenize.generate_tokens(io.StringIO('async def foo(): >>> pass').readline) >>> pprint.pprint(list(tokens)) [TokenInfo(type=55 (ASYNC), string='async', start=(1, 0), end=(1, 5