rouge icon indicating copy to clipboard operation
rouge copied to clipboard

Update Python builtin keywords, functions, and exceptions to Python version 3

Open joclement opened this issue 10 months ago • 2 comments

Python2 is EOL for a while now, see https://www.python.org/doc/sunset-python-2/. Thus, update the builtin keywords, function, and exceptions as how they are used by Python 3.

See: - https://docs.python.org/3/reference/lexical_analysis.html#keywords - https://docs.python.org/3/library/functions.html - https://docs.python.org/3/library/exceptions.html#exception-hierarchy

joclement avatar Feb 10 '25 20:02 joclement

@joclement Thank you for your contribution. Even though Python 2 is EOL, we still have users on the old version, plus we do not have a way to specify v2 and v3 like Pygments. For that reason, I would suggest avoid removing old keywords. What do you think?

tancnle avatar Apr 11 '25 06:04 tancnle

We don't interpret or run code, we only highlight it. Despite Python 2 being EOL, it is still reasonable to, e.g. write a blog post about it. I think there may be some merit into splitting these if they diverge too much, into e.g. a python and a python2 lexer, but if we can have one lexer that can highlight both, I don't see an issue with it.

jneen avatar Apr 12 '25 14:04 jneen

Thank you for the feedback and sorry for not addressing this earlier.

I reverted the changes dropping Python2 support.

Using git log -p -w --word-diff shows much better than the diff on GitHub that I just re-added keywords and broke too long lines.

joclement avatar Jul 11 '25 14:07 joclement

Thanks @joclement. LGTM 🚀

tancnle avatar Jul 15 '25 13:07 tancnle