File "nicetry.py", line 1:
from __future__ import braces
^
SyntaxError: not a chance
A VSCode-extension-to-be that inserts curly brackets, live, into Python code. This follows the old and unfunny "Python does have block delimiters!" joke:
def is_even(n):
# {
if n < 0:
# {
return is_even(-n)
# }
return not n if n < 2 else is_even(n - 2)
# }
- Some programmers depend on screen-readers, for which Python's lack of block delimiters poses difficulty.
- Certain Sam-I-ams coming from other languages do not like the idea of semantic indentation (because they wouldn't be indenting anyway).
- Because.
Many. But none AFAIK as a live editor extension!
- pybraces: The best implementation by far (and adaptable to Python 3 easily enough), but a touch fuzzy to use and may not play nice with code-analysis tools that don't consider encoding.
- bython: Requires a separate transpilation step. Definitely does not play nice with code-analysis tools.
- pindent.py: Comes with Python and uses nonintrusive comments, but requires a separate transpilation step and delimits blocks using words rather than {braces}.
- Live reformatting to braced Python
- On-save reformatting from braced Python
- Preservation of existing comments