AI and Python

François Pinard pinard at iro.umontreal.ca
Sat May 13 16:30:31 CEST 2000


"lexberezhny" <lexberezhny at email.msn.com> writes:

> I was wondering if anyone has dont any artificial inteligence with Python.

I once followed some AI courses in theoretical computer science, and later
worked for years in a few local AI laboratories.  The overall impression
that remained from the whole adventure is a lot of fuss, and many buzzwords
wrapping not that many results. :-)

Later in my life, I returned to university and took operation research.
In many occasions, we were using almost the same "AI" algorithms as before
to solve equivalent problems, without ever using "AI" in our discussions
and without any kind of fuss, just calmly seeking some results among other
sets of results.  I felt much more comfortable in that humble efficiency.

So, now less than ever, I do not know what "AI" really means.  Short of a
better explanation, and after having often observed how "expert systems",
Prolog and various other devices and languages were often horribly abused,
I'm now teasing people by saying that AI is the Art of Programming without
resorting to natural intelligence. :-)

The only real AI programs I knew were made by fundamentalists in psychology,
trying to get the computer to mimic how humans solve actual problems,
usually after a _great_ deal of introspection and human protocol analysis.
This is hardly a computer science problem, and using LISP instead of COBOL
to represent the achieved comprehension comes more folklore than from any
deep need.  I'm exaggerating a bit here, of course, but my point is that LISP
superiority is contained in itself, and not especially related to _real_ AI.

One could ask about how expressive Python is about difficult algorithms.
I would ask myself how easy or difficult it would be translating to Python
some difficult algorithms I once wrote in Pascal, Scheme or assembler, say!
My overall impression, so far, without having really tried, is that Python
would be a helpful system to implement any of these.  There might be some
language specificities which do not immediately translate to Python, but
then, these could be either reformulated using more common Python idioms,
or else, be re-implemented in Python to some extent, without much pain.
Programs might be less small, but might gain in legibility, which is a
good trade-off for long term maintainability.  In a word and as a summary,
I would not hesitate tackling difficult problems with Python.

To be completely honest, I still have a pending doubt about computation
speed.  For some difficult algorithms I tackled in the past, I used languages
giving me the means for many kind of optimisations.  Python will be fully
on my side for algorithmic optimisations, of course, but I'm not fully
sure what I would get for some raw, linear, brute force optimisation.
Like compiling on the fly to machine code, say.  I know one could make C
extensions to Python modules, but I always saw them as module-static, so
far, and probably cumbersome to handle otherwise.  The truth is that I do
not know what the outcome would be.  I would probably have to benchmark a
real problem into Python and compare, but this is hardly something I can do
in my spare time, given that difficult algorithms are not always small :-).

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard






More information about the Python-list mailing list