UHG
Search
Close this search box.

Meet Bython, the Python With Braces

Bython is Python with braces because Python is awesome, but whitespace is awful.

Share

Listen to this story

Python has long been celebrated for its simplicity and readability. However, for developers coming from languages like C++ or Java, this syntax can sometimes feel unfamiliar or challenging. This problem served as an inspiration for Bython, funnily touted as the Python with braces

Bython is a Python preprocessor which aims to provide an alternative syntax for Python that uses curly braces to define code blocks, similar to languages like C++ or Java, while still leveraging Python’s interpreter and ecosystem.

But it does not end there. The main aspect of Bython is you don’t have to worry about indentation. It won’t give you errors even if you mess up tabs/spaces or copy one piece of code to another that uses a different indentation style; it won’t break.

Javascript for Python?

Python usually gets a lot of hate for whitespaces as when you accidentally mix tabs and spaces, it gives you an error which is hard to find. A Reddit user mentioned that he loves brackets as it does not break while copying. “I spend more time tabbing than I do putting two brackets and auto formatting,” he added further. 

The key thing to note here is that Bython uses Python for interpretation, meaning existing Python modules like NumPy and Matplotlib still work seamlessly.

Jagrit Gumber, a frontend developer on X, while praising Bython, mentioned that Bython is really worth it if you come from a C C++, C# or Java background. 

Some developers prefer using braces in code because it allows them to freely cut, paste, and rearrange code sections, relying on automatic formatting tools to correctly align and indent the code afterwards, regardless of how it was initially typed.

It is also related with muscle memory of programmers who are coming from other programing languages. When you spend enough time with one programing language, you develop a habit of using curly braces and most programming languages do use braces. A developer on Hackernews mentioned that he had developed a muscle memory of using braces by pressing Ctrl + M and he was able to parse code much faster when it is both indented and with proper brackets.

Bython also allows developers to write code that is both easy to read and write, like Python, while also being able to leverage the efficiency and speed of C. “Bython provides easy ways to call C functions and leverage C libraries, more control over hardware, and performance optimisations,” said Saikat Sinha Ray while explaining how Bython can be used to call C functions. 

Some users loved Bython so much that they wanted all its features to be integrated into Python itself. A user on Hackernews mentioned said, “This shouldn’t be “Bython”, it should be Python 4.0,” suggesting the next iteration of Python 4.0 should have Bython baked into it. 

Will Bython Replace Python?

While Bython solves some key issues which bothers multiples users, it can not replace Python by any means. Bython is more like a passion project from Mathias Lohne and it is not meant to be integrated into the Python project as not everyone finds the whitespaces an issue. 

There are users who want to use Python and have no issues with its syntax. There are even users who hate the idea of using braces and find the syntax of Python better than ever. So we would suggest to think of Bython as an extension of Python which is optional and can be used if you have issues with braces and whitespaces.

📣 Want to advertise in AIM? Book here

Picture of Sagar Sharma

Sagar Sharma

A software engineer who loves to experiment with new-gen AI. He also happens to love testing hardware and sometimes they crash. While reviving his crashed system, you can find him reading literature, manga, or watering plants.
Related Posts
Association of Data Scientists
Tailored Generative AI Training for Your Team
Upcoming Large format Conference
Sep 25-27, 2024 | 📍 Bangalore, India
Download the easiest way to
stay informed

Subscribe to The Belamy: Our Weekly Newsletter

Biggest AI stories, delivered to your inbox every week.

Flagship Events

Rising 2024 | DE&I in Tech Summit
April 4 and 5, 2024 | 📍 Hilton Convention Center, Manyata Tech Park, Bangalore
Data Engineering Summit 2024
May 30 and 31, 2024 | 📍 Bangalore, India
MachineCon USA 2024
26 July 2024 | 583 Park Avenue, New York
MachineCon GCC Summit 2024
June 28 2024 | 📍Bangalore, India
Cypher USA 2024
Nov 21-22 2024 | 📍Santa Clara Convention Center, California, USA
Cypher India 2024
September 25-27, 2024 | 📍Bangalore, India
discord icon
AI Forum for India
Our Discord Community for AI Ecosystem, In collaboration with NVIDIA.