Global Constant
Steve Nay's ramblings

Simple comparison of Sinatra and Bottle

I needed to write a very simple web server today. I maintained a small Sinatra server when I was the TA for CS 462. The code was clean and sensible, so I decided to give it a try.

However, liking Python as I do, I went searching for a Sinatra lookalike for Python. There are a few, but I tried Bottle.

I implemented the server using both frameworks for comparison. Here’s what the code for each looks like, with Bottle on the left and Sinatra on the right (click to enlarge):

The Bottle version of the server is several lines longer and not quite as succinct. While I’m still new to Ruby, there are several things I like better about its syntax than Python’s (e.g., the .to_i operator, beestings, better handling of “global” variables–settings in this case).

I think Sinatra wins here. What do you think?

Later article
Dialoguing module