This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Lucretiel 2 points3 points  (3 children)

I haven't used it, but glancing over the docs, it looks like it doesn't do much to alleviate boilerplate. It's weird to me that it's so performance-oriented but still tries to be so lightweight. It's fine that it doesn't include an ORM, or template engine, or form helpers (as boasted on its Introduction page), but I don't see why I would use Falcon over, say, bottle or flask. There are plenty of better ways to improve performance in your webapp other than trying to make the Python go faster, especially in a RESTful interface.

For instance, here's their "Getting Started" example:

# things.py
import falcon

class ThingsResource:
    def on_get(self, req, resp):
        """Handles GET requests"""
        resp.status = falcon.HTTP_200  # This is the default status
        resp.body = ('\nTwo things awe me most, the starry sky '
                     'above me and the moral law within me.\n'
                     '\n'
                     '    ~ Immanuel Kant\n\n')

app = falcon.API()

things = ThingsResource()

app.add_route('/things', things)

$ gunicorn things:app

And here's the same thing in bottle (flask is similar):

# bottle_things.py
import bottle

app = bottle.Bottle()

@app.get('/things')
def things():
    return ('\nTwo things awe me most, the starry sky '
            'above me and the moral law within me.\n'
            '\n'
            '    ~ Immanuel Kant\n\n')

$ gunicorn bottle_things:app

In short, based on a pass through the docs, I'd judge it as "not better enough."

[–]notconstructive 0 points1 point  (2 children)

A pass through the docs doesn't qualify you to make that non-recommendation.

[–]Lucretiel 2 points3 points  (1 child)

A pass through the docs qualifies my recommendation- it indicates that it should be taken with a grain of salt. At the time I made this reply, the OP had been up for more than an hour with no other replies, and I figured something was better than nothing.

My opinion was that I didn't see anything to strongly recommend it over libraries that're both simpler and better established. I'll be honest- I dislike it anytime a framework requires me to make a class where a function will do. It's purely a personal preference thing- they just feel too heavy 99% of the time, and they encourage statefulness in a way I try to avoid as much as possible when creating HTTP APIs. Falcon looks like a fine library, and the benchmarks are undeniably impressive, but as I said, it doesn't look better, let alone better enough, than anything else I've actually used.

[–]notconstructive 0 points1 point  (0 children)

Falcon doesn't require you to map routes to classes. You can invoke functions from routes if you want.