Make App Pie

Training for Developers and Artists

From Apple to Raspberry Pi: Look ma! No Braces!!

I recently found a Post on Google Plus from that only a programmer would love:

Of course this is an endless debate of where to put the braces of a block of code.  C, C++, Java, JavaScript, Objective-C and even CSS uses those lovely curly braces.

Python does something totally mind tripping to me: it doesn’t use them. Here’s the same if statement in Python:

if condition:
    #a comment ...

In Python there is no braces:only white space. By convention there are four spaces. When there is no more indent, no more block.

Of course I do a lot of indentation in Xcode. But that is just documentation. In Python it’s syntax — and you can nest them too!

Another thing for me to swallow.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: