Live data from Hacker News

Flask is awesome

poincare101.blogspot.com

11–15 of 15 posts

Re: Flask is awesome

#11
post #9

Rather than quibbling over syntax, I'd like to comment on a real concern I have about blogs, particularly ones that engage in hagiographies on things they don't appear to rightly understand. Nota bene: I am a user of Flask and have been one for quite some time. I am incredibly fond of it and it has replaced Django for most things I do in web dev. I am very familiar with it and its limitations/ugly corners. Familiarit…

I think this is a very valid point, and it comes up quite frequently in comparison of frameworks and libraries. One example that was annoying me recently was in trying to select a Javascript client-side MVC (MVVM, etc.) framework for a single-page application. The internet is full of people busily comparing, contrasting, arguing about, and recommending JS frameworks. Problem: 95% of them are doing so based on a No re…

You'd hit what I was talking about precisely on the head.

I feel your pain on figuring out which JavaScript SPA framework to use. I don't think I've seen any particularly compelling examples in public of even Backbone.js, which is currently the most popular one to use. The templating and sync semantics aren't appealing.

And yes, some of my proudest moments, too, have been making a The hairy problems are when the rubber meets the road and whether or not the solution I've built on is going to be appropriate or not. Those are going to be >100 line of code problems.

I have to be able to build things of at least moderate complexity with a framework without blood gushing my eyes and ears.

The superficiality of this non-content makes my spleen rupture.

Re: Flask is awesome

#12
post #5
post #3

Earlier quoted context omitted.

Flask: from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run() Sinatra: require 'sinatra' get '/hi' do "Hello World!" end

Note that there is no need for the conditional if you just want to serve this route (and there is no need for the conditional block at all if you're just defining view functions), and that this whole block exists once per project . And that a Flask app is a proper WSGI application (as opposed to a self-running Sinatra handler which has to be quite significantly modified to be Rack-compatible) As a result, the actual…

as opposed to a self-running Sinatra handler which has to be quite significantly modified to be Rack-compatible

Huh? Here's the `config.ru` that you need:

  $: 
Note that I have no stake in the verbosity claims, as it's not something I particularly care about. But I wouldn't consider this a significant modification.

Re: Flask is awesome

#13

Whenever I see Flask code, it just reminds me how unbelievably succinct Sinatra is. I imagine it's a limitation of Ruby vs Python for creating DSLs, but a basic Flask app just seems so verbose. It's like seeing "Hello World" in Java vs "Hello World" in a dynamic language like python or ruby.

>Whenever I see Flask code, it just reminds me how unbelievably succinct Sinatra is.

I hereby dub this the programmer equivalent of "sharp knees".

Explanation from the ever inimitable Urban Dictionary:

"A judgment leveled against an otherwise perfectly proportioned, if not slightly trim, and pleasant looking woman. Generally uttered by a male who is way below her class."

This comment is otherwise beneath a reasoned response.

Re: Flask is awesome

#14
post #12
post #5

Earlier quoted context omitted.

Note that there is no need for the conditional if you just want to serve this route (and there is no need for the conditional block at all if you're just defining view functions), and that this whole block exists once per project . And that a Flask app is a proper WSGI application (as opposed to a self-running Sinatra handler which has to be quite significantly modified to be Rack-compatible) As a result, the actual…

as opposed to a self-running Sinatra handler which has to be quite significantly modified to be Rack-compatible Huh? Here's the `config.ru` that you need: $: Note that I have no stake in the verbosity claims, as it's not something I particularly care about. But I wouldn't consider this a significant modification.

> Huh? Here's the `config.ru` that you need:

Really? I remember it being significantly more work in the past, like having to change the `require` and create a class around all the routing methods

If that's all which is required to make a Sinatra app into a good Rack citizen, then consider my previous assertion wrong and rescinded.

Re: Flask is awesome

#15

Whenever I see Flask code, it just reminds me how unbelievably succinct Sinatra is. I imagine it's a limitation of Ruby vs Python for creating DSLs, but a basic Flask app just seems so verbose. It's like seeing "Hello World" in Java vs "Hello World" in a dynamic language like python or ruby.

Whoa.. backlash.

The intention wasn't to diss Flask. It is a very concise and useful framework. All the comments apply to my original comparison.

  public static void main(..){
    System.out.println("Hello World");
  }
really isn't much more verbose than

  print "Hello World"
yet every tutorial on a new language points out how frustrating it is for someone learning the language to type "public" "static" "void" "System" and other keywords/objects/modules without having any idea what they mean just to do something simple.

In Flask I need to instantiate the Flask app, define a function to run and decorate it with a route. That raises all sorts of questions about what a decorator is (which for a casual pythonist may or may not be something they understand - I know my understanding of decorators is sketchy at best). Then I need to explicitly call app.run() somewhere.

In Sinatra, the DSL makes it much simpler. If I receive a "get '/'" request, then "do" the following stuff. "end".

Flask is very concise. No doubt about it. It's stripped down to it's very minimum. Yet Sinatra manages to be even simpler, which is impressive to me.

Post reply on HN