News for hackers. Stuff that matters.
Re:Python web micro-framework battle by the_mitsuhiko on Sunday August 28, 2011 @12:42PM (#2934271)
I have no idea how the LOC numbers of Flask come together though. Flask itself is 1.4KLOC, Jinja2 is 6.5KLOC and Werkzeug is 10KLOC (all measured without tests). Even if you add them up you don't end up with 32KLOC.
Re:Python web micro-framework battle by defnull on Sunday August 28, 2011 @01:08PM (#2934338)
The author probably did something like this:

    sudo pip install -u flask
    cd /usr/local/lib/python2.6/dist-packages
    find flask/ werkzeug/ jinja2/ -name '*.py' | xargs wc
    ...
      34936  127298 1658380 total
Werkzeug alone has 18KLOC and does not ship with tests.
Re:Python web micro-framework battle by the_mitsuhiko on Sunday August 28, 2011 @01:16PM (#2934363)
Those are not lines of code. That includes docstrings which all of Pocoo code is full of. If you want to measure lines of code you at least have to skip comments, docstrings and empty lines. And for that there is sloccount. This also includes the testsuites btw.

With this little script (http://paste.pocoo.org/show/465885/) I get the following results:

    Flask      1467 LOC
    Jinja2     6560 LOC
    Werkzeug   9923 LOC
    Bottle     1910 LOC
(FWIW)
Re:Python web micro-framework battle by defnull on Sunday August 28, 2011 @01:29PM (#2934412)
There are better ways to count LOC, I agree. But the idea is the same: Bottle does what it does with 1/10 of the code that runs flask.
Re:Python web micro-framework battle by the_mitsuhiko on Sunday August 28, 2011 @01:40PM (#2934440)
> Bottle does what it does with 1/10 of the code that runs flask.

Not all of the code that is in Jinja2 or Werkzeug is used by the average Flask application. Also Flask does a lot more than Bottle, even for the same things. The routing system behind Werkzeug itself already comes close to 1KLOC (and for good reasons). Which is why I think that any comparison between Bottle and Flask is pretty pointless, it's not really a fair fight for either.

For Flask it was never a goal to have less code than another framework, in fact, from our perspective that's quite a pointless goal.

Re:Python web micro-framework battle by DasIch on Sunday August 28, 2011 @01:44PM (#2934455)
Flask also has more features and unless you find a way to accurately rate features for their usefulness and compare all those somehow the LOC metric has practically no meaning.

It would be much more interesting for potential users if people started comparing lines of documentation(LOD) and showed the quotient lines of tests/lines of code.

Re:Python web micro-framework battle by defnull on Sunday August 28, 2011 @02:09PM (#2934532)
LOC and LOD suffer from the same problem: You can write (or generate) lots of code or documentation that does not help the user. You can even write docs that confuse the user, repeat a lot, to not get to the point and so on. In that case, more is even worse than less. There is no number to measure the usefulness of a framework or the quality of code. And there is no point in comparing frameworks just by numbers.
Re:Python web micro-framework battle by DasIch on Tuesday August 30, 2011 @05:20PM (#2943311)
You will notice bad documentation almost immediately which makes the disadvantage of using LOD as a metric practically irrelevant.