mathialo / bython

Python with braces. Because python is awesome, but whitespace is awful.
MIT License
2.13k stars 54 forks source link

Mixed mode #21

Closed ole-tange closed 6 years ago

ole-tange commented 6 years ago

I want this to work:

#!/usr/bin/env bython

def a():
  print("a")

def b() {
if 4<5:
  print("b")
}

a()
b()

The situation here is: I get a Python script that I edit. Most of it is white-space indented correctly. But parts of it use braces.

In particular I need braces to paste-in a section. In the above I got the if and print statements from another source with different indention. So I simply wrapped it with {} and this should then be understood correctly.

So I am asking for a mixed mode, where indention matters if there are no braces overriding it.

mathialo commented 6 years ago

This was a registered issue a while back too.

Since then, the python-to-bython translator has been improved quite a bit. You should now be able to convert the python code to bython, and then use only braces for block definitions. That would be a much cleaner solution than allowing the mix (which in my opinion would be an inconsistent and bad language design)