Request for help with Python/Flask – Prośba o pomoc z Pythonem/Flaskiem

( wersja polska poniżej )

I (not-so) recently started to learn Python. To have some playground that I can work on, I decided to write simple website that will let me track scores of a card game that I play with my family – Canasta.

To write it, I chose to use Flask framework, so I learned at the same time both Python and Flask.

Final result (without layout, just functionality) is on github.

If any of you does write Python and/or Flask, I would greatly appreciate all comments. Even the harsh ones. If anything is wrong, or simply not really good – let me know – I'm treating it as a way to learn so all feedback would be good.

Just a word of warning – if you'll decide to look at it – you will be dealing with very bad Python code. Brace yourself.


Niedawno zacząłem uczyć się Pythona. Uczę się najlepiej robiąc coś, więc stwierdziłem, że zrobię prosty site do śledzenia wyników gry w którą gram z rodziną – kanasty.

Zdecydowałem, że użyję Flask'a – dzięki czemu uczyłem się jednocześnie i języka (Python) i frameworka (Flask).

Działająca wersja (bez wyglądu, sama funkcjonalność!) jest na githubie.

Jeśli znasz Pythona i/lub Flaska, byłbym bardzo wdzięczny za przejrzenie tego kodu i skomentowanie. Nawet zbluzganie. Jeśli cokolwiek jest źle, lub nie-za-dobrze, daj mi znać. To (ten soft) to dla mnie metoda na nauczenie się, więc każdy komentarz jest mile widziany.

Słówko ostrzeżenia jedynie: jeśli się zdecydujesz na to spojrzeć, miej świadomość, że to będzie bardzo zły kod w Pythonie. Tragiczny. Bądź gotów.

Waiting for 9.2 – pg_stat_statements improvements

Three interesting patches:

  • On 27th of March, Robert Haas committed patch:
    New GUC, track_iotiming, to track I/O timings.
     
    Currently, the only way to see the numbers this gathers is via
    EXPLAIN (ANALYZE, BUFFERS), but the plan is to add visibility through
    the stats collector and pg_stat_statements in subsequent patches.
     
    Ants Aasma, reviewed by Greg Smith, with some further changes by me.
  • On 27th of March, Robert Haas committed patch:
    Expose track_iotiming information via pg_stat_statements.
     
    Ants Aasma, reviewed by Greg Smith, with very minor tweaks by me.
  • On 29th of March, Tom Lane committed patch:

    Improve contrib/pg_stat_statements to lump "similar" queries together.
     
    pg_stat_statements now hashes selected fields of the analyzed parse tree
    to assign a "fingerprint" to each query, and groups all queries with the
    same fingerprint into a single entry in the pg_stat_statements view.
    In practice it is expected that queries with the same fingerprint will be
    equivalent except for values of literal constants.  To make the display
    more useful, such constants are replaced by "?" in the displayed query
    strings.
     
    This mechanism currently supports only optimizable queries (SELECT,
    INSERT, UPDATE, DELETE).  Utility commands are still matched on the
    basis of their literal query strings.
     
    There remain some open questions about how to deal with utility statements
    that contain optimizable queries (such as EXPLAIN and SELECT INTO) and how
    to deal with expiring speculative hashtable entries that are made to save
    the normalized form of a query string.  However, fixing these issues should
    require only localized changes, and since there are other open patches
    involving contrib/pg_stat_statements, it seems best to go ahead and commit
    what we've got.
     
    Peter Geoghegan, reviewed by Daniel Farina

Continue reading Waiting for 9.2 – pg_stat_statements improvements