[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnubg] Three things that are broken

From: Christian Anthon
Subject: Re: [Bug-gnubg] Three things that are broken
Date: Mon, 16 Apr 2007 10:13:03 +0200

The python code is broken, imho.

First of all, if you want to extend the code using python you need to
be fluent in a lot of different things. Let me take the rdb as an
example. You need to be able to code in c and python and you need to
be able to use the python C API, which is simply a pain. The code for
making a simple sql query is 117 lines of C (including a lot of
C/python magic) and 22 lines of python. In the sqlite3/c api it could
be boiled down to:

static int relational_query(const char *query, sqlite3_callback callback,
                           void *p)
       sqlite3 *db;
       char *error;
       if (sqlite3_open("/home/anthon/.gnubg/gnubg.db", &db)) {
               outputerrf("Can't open database: %s\n",
               return -1;
       if (sqlite3_exec(db, query, callback, p, &error) != SQLITE_OK) {
               outputerrf("SQL error: %s\n", error);
               return -2;
       return 0;

and that is not even being fair on the sqlite code since you need to
do some extra things to make the python code work. So that's a
relation of roughly 1:8 in number of coded lines.

As for the interface between python and gnubg, my main objections are:

a) It will always be mainly a developers feature.
b) We already have the internal scripting language in which you can do
90% of the things you would like to do with the python interface
c) The python interface is another layer of abstraction and we have
enough problems making making the text and gtk interfaces work well at
the same time.
d) The python interface has been sitting there for a long time without
anybody adding features to it, and therefore I find it unlikely to
happen in the near future.
e) Reread comments about the rdb.

By the way, could you take a look at this bug:

I'll be as sad as most to see the python interface go. I just feel
that we have a few features left half finished by the previous
developers, and either we cut them loose or we finish them in a way so
that they are usable by the average user (not that that is ever going
to be the case with the python interface).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]