Re: What is different with Python ? (OT I guess)

2005-06-15 Thread david . tolpin

> > Oh well, I guess it's a bit late to try to rename the Computer
> > Science discipline now.
> The best I've heard is "Informatics" -- I have a vague impression
> that this is a more European name for the field.

The word "Informatics" had been invented by a Soviet computer scientist
Andrey Ershov several decades ago  as a name for his view on
Information Theory. In Russian, it is Информатика,
Informatika, by analogy with Mathematics, Математика. It is
widely used ever since both in russian-language literature and in many
other languages and countries.

It is a better name than either Information Theory or Computer Science
for the discipline.

-- 
http://mail.python.org/mailman/listinfo/python-list

cgi.py?

2005-05-29 Thread david . tolpin
Hi,

I've looked into cgi.py from 2.4's distribution, and its contents
puzzle me. In parse_header, the first line splits on ';':

plist = map(lambda x: x.strip(), line.split(';'))

but header parameters may contain semicolon in quoted strings:

   Content-Type: image/jpeg; filename="home:lib;images;face.jpg"

and headers like this one will be parsed incorrectly. A few subsequent
lines unquote a quoted value, but the only place where quoted-string
production is defined is RFC 3875, and there is no quote escaping in
the production (nor in any other draft or related RFC). So, even if the
former is fixed, the latter will still prevent headers like

  Content-Type: text/plain; filename="c:\files\"; title="My Files"

from being parsed correctly. What am I missing?

David

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python features

2005-05-12 Thread david . tolpin
> There are three main types of programming languages.
>
>  * Imperative
>  * Functional
>  * Declarative
>

animals are divided into:

* those that belong to the Emperor,
* embalmed ones,
* those that are trained,
* suckling pigs,
* mermaids,
* fabulous ones,
* stray dogs,
* those included in the present classification,
* those that tremble as if they were mad,
* innumerable ones,
* those drawn with a very fine camelhair brush,
* others,
* those that have just broken a flower vase,
* those that from a long way off look like flies.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pyvm -- faster python

2005-05-12 Thread david . tolpin
> I don't think Python can ever beat
> carefully coded C for running speed, but it can and should aim for
> parity with compiled Lisp.

But common lisp compilers often beat C compilers in speed for similar
tasks
of moderate complexity. In particular, CMUCL beats GCC in numerical
computations.

David

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with national characters

2005-03-31 Thread david . tolpin

> Is there a way around this problem?

put

import sys
sys.setdefaultencoding('UTF-8')

into sitecustomize.py in the top level of your PYTHONPATH .

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: FAQ 1.7.3 : How can I have modules that mutually import each other

2005-03-21 Thread david . tolpin

> Needs??? Sorry to be blunt, but this is an intrinsically ludicrous
> concept, in *any* language. The whole idea of modules is (wait for
it)
> "modularity". "A imports B which imports A" is an utter nonsense.
>

There is such a thing called 'recursion'. Self-recursion is when
function x calls itself to execute the same action on a partial result
of its previous invocation. This technique is a natural expression of
what such ugly constructs as for and while  are for in some programming
languages. Indirect recusion is when function x calls y, and function y
calls x. It is often happens in state automata.

A static equivalent of indirect recursion is dependencies between
declarations, when declaration x depends on y, and declaration y
depends on x. Imagine a design
of a literate programming environment, where both documentation and
text are structured, and either can contain the other. A natural design
for that is to have two modules, one implementing the parser for
documentation, the other implementing the parser for code, each
referencing the other so that both parsers can call each other when
they need to switch context.

In a well-designed programming language, circular intermodule
dependencies are normal, because this is a natural high-level
abstraction to express such relations. Because of primitive
implementation of modular system in Python, circular dependencies are
not possible, and things which are normally done automatically in a
higher-level language, need to be coded manually in Python.

In particular, to bypass this deficiency of Python for a problem
similar to one described above, one has to define base classes for each
of the two parsers, and make the implementations depend on the other
implementation's base class, not on itself, thus splitting the
interface and the implementation where it is not only unnecessary but
outright wrong if clean design is taken into consideration.

I'd wish a cleaner and more consistent implementation of packages
existed in Python; but unfortunately too many things in current Python
are far from being on the level a modern programming language (such as
Common Lisp, for example) demands.

David Tolpin
http://davidashen.net/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What is print? A function?

2005-01-24 Thread david . tolpin

> Is it possible to create own statements, such that it would be
possible to do:
>
> printDebug "test"
>
> ?
This question is well addressed in a neighbour group comp.lang.lisp .

-- 
http://mail.python.org/mailman/listinfo/python-list