braces.py
braces.py is a library that allows using {}
braces and ;
for indentation.
Warning
There is a known limitation in braces.py. That is, indentation like this does NOT work:
def identity(value: T) -> T
{
return value;
}
The said limitation was partially intentional, as it brings more problems than solutions in analysis.
Installing
Python 3.5 or higher is required
To install the library, you can just run the following command:
# Linux / OS X
python3 -m pip install --upgrade braces.py
# Windows
py -3 -m pip install --upgrade braces.py
In order to install the library from source, you can do the following:
$ git clone https://github.com/nekitdev/braces.py
$ cd braces.py
$ python -m pip install --upgrade .
Quick example
Below is an example of identity function using braces style.
# coding: braces
from typing import TypeVar;
T = TypeVar("T");
def identity(some: T) -> T {
return some;
}
This snippet gets translated to syntactically valid python code:
from typing import TypeVar
T = TypeVar("T")
def identity(some: T) -> T:
return some
You can find more examples in examples directory.
Authors
This project is mainly developed by nekitdev, with help of isidentical.