My love hate relationship with Python

#When did it all start

Python was the first language I learned back when I was 8 and I loved it. I could make a cool console based game or pretend I was hacking, who wouldn’t want to do that? I have a few of my early creations I found lying around on my old computer hosted on my Github Gist page. And they honestly were super cool! I loved the fact I could type maybe 5-10 lines and still have something cool to show - it was simple. It didn’t have any of the complicated structures of C# or other C languages.

But now I’ve changed and I’ve learnt languages such as JavaScript and Go and I just can’t go back - it’s too simple. I found that while programming my GCSE Project I loved using Python again but hated the lack of structure… where are my brackets?

If I could do something like below, then I would be in love with Python.

def function(text) {
  ... do something 


So, naturally to add a sense of self security and structure to my Python project, I decided to Google something along the lines of “How to get curly brackets in Python”, to which I found an article on Stack Overflow titled “Is it true that I can’t use curly braces in Python?”. It seems whoever wrote that seemed a little upset. Nevertheless, I clicked on it and started reading. There were many sarcastic responses such as:

if foo: #{
    print "it's true"
else: #{
    print "it's false!"

Which I did actually find quite funny but there was one the caught my eye, I saw an import function :eyes:. It said: “You can try to add support for braces using a future import statement, but it’s not yet supported, so you’ll get a syntax error.” and preceded to show this snippet:

>>> from __future__ import braces
  File "<stdin>", line 1
SyntaxError: not a chance

If you look closely you can see the syntax error “not a chance”. It turns out this is a little easter egg from the developers behind Python of essentially saying “Nope, we’re never adding it!” which kind of makes me a little sad but then I suppose good on them for sticking to their simple design scheme.

#Further Research

So, although I now knew brackets were never going to be a part of Python, I decided to see if anyone had made a compiler or pre-processor for this sort of thing. And to my amaze, they had! I found Bython - Python with braces. And from what the project says, it looks pretty easy to configure, you install and use a separate command instead of Python to run. And it comes with a command to convert Python to Bython. Pretty neat huh!

Although I will probably never use Python again (or at least for a while), it’s nice to know that Bython is a thing. And Mathias sums this article up pretty well: Because Python is awesome, but whitespace is awful.

© 2020