Python needn't apologize (was: Using Python for programming algorithms)

2008-06-01 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, sturlamolden <[EMAIL PROTECTED]> wrote: >On May 18, 5:46 am, "inhahe" <[EMAIL PROTECTED]> wrote: > >> The numbers I heard are that Python is 10-100 times slower than C. > >Only true if you use Python as if it was a dialect of Visual Basic. If >you use the right tool

Re: Using Python for programming algorithms

2008-05-21 Thread sturlamolden
On May 21, 11:59 am, Bruno Desthuilliers wrote: > Strange enough, no one calls Java or C# 'interpreted languages', while > they (or, to be more exact, their reference implementations) both use > the same byte-code/VM scheme[1]. Java interprets the bytecode in a virtual machine by default. Only

Re: Using Python for programming algorithms

2008-05-21 Thread sturlamolden
On May 21, 12:01 pm, Bruno Desthuilliers wrote: > > C has proven very difficult to optimize, particularly because pointer > > aliasing prevents efficient register allocation. > > Does this compare to optimizing something like Python ? (serious > question, but I think I already know part of the an

Re: Using Python for programming algorithms

2008-05-21 Thread Frédéric Degraeve
I reply to myself! > > Boost.Python is also very known (but never tested by myself). > http://www.boost.org/doc/libs/1_35_0/libs/python/doc/tutorial/doc/html/index.html here the example. I know that it has been made to simplify the CPython's use and this is based on CPython. Frédéric -- http://m

Re: Using Python for programming algorithms

2008-05-21 Thread Frédéric Degraeve
> By the way, is it possible (and easy) to call a C function from a > Python program?? Use SWIG. It's easy, smart and beautiful. After that, you can call C/C+ + from a lot of scripting languages such as python, R, etc A lot of open sources projects already use it. http://www.swig.org/tutorial.ht

Re: Using Python for programming algorithms

2008-05-21 Thread Bruno Desthuilliers
sturlamolden a écrit : On May 19, 10:42 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: Well... They do - they are called 'C compilers' !-) As Roel Schroven mentioned - and he is at least partially right on this point - C has been designed to make optimizing C compiler not to hairy to write.

Re: Using Python for programming algorithms

2008-05-21 Thread Bruno Desthuilliers
Roel Schroeven a écrit : Wow this resulted in far more reactions than I had expected ... [EMAIL PROTECTED] schreef: On 19 mai, 15:30, Roel Schroeven <[EMAIL PROTECTED]> wrote: Bruno Desthuilliers schreef: 1/ being interpreted or compiled (for whatever definition of these terms) is not a prop

Re: Using Python for programming algorithms

2008-05-20 Thread Paddy
On May 17, 11:32 pm, Vicent Giner <[EMAIL PROTECTED]> wrote: > Hello. > > I am new to Python. It seems a very interesting language to me. Its > simplicity is very attractive. > > However, it is usually said that Python is not a compiled but > interpreted programming language —I mean, it is not like

Re: Using Python for programming algorithms

2008-05-20 Thread Paddy
On May 19, 8:09 pm, Lou Pecora <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Roel Schroeven <[EMAIL PROTECTED]> wrote: > > > > > Bruno Desthuilliers schreef: > > > 1/ being interpreted or compiled (for whatever definition of these > > > terms) is not a property of a language, but

Re: Using Python for programming algorithms

2008-05-20 Thread Kay Schluehr
On 18 Mai, 00:32, Vicent Giner <[EMAIL PROTECTED]> wrote: > Maybe this is not the right forum, but maybe you can give me some > hints or tips... > > Thank you in advance. If Python doesn't run in production systems execution speed doesn't matter much. What actually matters when *developing* non-t

Re: Using Python for programming algorithms

2008-05-20 Thread sturlamolden
On May 20, 3:37 pm, brad <[EMAIL PROTECTED]> wrote: > seen this first hand. Getting results back the same day or sooner may be > important. In cases such as this, I use C or C++... nothing else will > do. Nothing else is as fast. Right. Tell that to the Fortran community. And by the way: http://

Re: Using Python for programming algorithms

2008-05-20 Thread Aahz
In article <[EMAIL PROTECTED]>, brad <[EMAIL PROTECTED]> wrote: > >Run time is not important until you are asked to scale to millions >or billions of users or computations or large data sets. I've seen >this first hand. Getting results back the same day or sooner may be >important. In cases such a

Re: Using Python for programming algorithms

2008-05-20 Thread Roel Schroeven
Wow this resulted in far more reactions than I had expected ... [EMAIL PROTECTED] schreef: On 19 mai, 15:30, Roel Schroeven <[EMAIL PROTECTED]> wrote: Bruno Desthuilliers schreef: 1/ being interpreted or compiled (for whatever definition of these terms) is not a property of a language, but a

Re: Using Python for programming algorithms

2008-05-20 Thread sturlamolden
On May 20, 7:24 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > > http://docs.python.org/lib/module-ctypes.html > Also see Cython (or Pyrex if you prefer the original). With Cython it is easy to call C functions, but Cython also alleviates the need for C to a great extent. The advantage of Cython

Re: Using Python for programming algorithms

2008-05-20 Thread Grant Edwards
On 2008-05-20, Ivan Illarionov <[EMAIL PROTECTED]> wrote: > On Mon, 19 May 2008 11:07:06 -0700, Vicent Giner wrote: > [...] >> >> By the way, is it possible (and easy) to call a C function from a Python >> program?? > > Yes. > > http://groups.google.com/group/comp.lang.python/msg/9d47913a265c348a

Re: Using Python for programming algorithms

2008-05-20 Thread sturlamolden
On May 19, 10:42 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Well... They do - they are called 'C compilers' !-) As Roel Schroven > mentioned - and he is at least partially right on this point - C has > been designed to make optimizing C compiler not to hairy to write. C has proven very

Re: Using Python for programming algorithms

2008-05-20 Thread sturlamolden
On May 19, 8:07 pm, Vicent Giner <[EMAIL PROTECTED]> wrote: > By the way, is it possible (and easy) to call a C function from a > Python program?? Yes it is. You can e.g. use ctypes for that. -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Python for programming algorithms

2008-05-20 Thread Arnaud Delobelle
brad <[EMAIL PROTECTED]> writes: >> Vicent Giner wrote: > >> The usual answer is that development time is more important than >> running time. > > This depends. Run time is not important until you are asked to scale > to millions or billions of users or computations or large data > sets. I've seen

Re: Using Python for programming algorithms

2008-05-20 Thread Duncan Booth
Roel Schroeven <[EMAIL PROTECTED]> wrote: > C OTOH was designed to be compiled to assembly code (or directly to > machine code) and as a result there are no (or virtually) no > implementations that interpret C or compile it to bytecode. Have you considered Microsoft's C/C++ compiler targetted a

Re: Using Python for programming algorithms

2008-05-20 Thread brad
Vicent Giner wrote: The usual answer is that development time is more important than running time. This depends. Run time is not important until you are asked to scale to millions or billions of users or computations or large data sets. I've seen this first hand. Getting results back the sa

Re: Using Python for programming algorithms

2008-05-20 Thread Ivan Illarionov
On Mon, 19 May 2008 11:07:06 -0700, Vicent Giner wrote: [...] > > By the way, is it possible (and easy) to call a C function from a Python > program?? Yes. http://groups.google.com/group/comp.lang.python/msg/9d47913a265c348a -- Ivan -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Python for programming algorithms

2008-05-20 Thread Ivan Illarionov
On Mon, 19 May 2008 08:53:11 -0700, Henrique Dante de Almeida wrote: > On May 19, 6:52 am, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: >> Henrique Dante de Almeida a écrit : >> >> > On May 17, 7:32 pm, Vicent Giner <[EMAIL PROTECTED]> wrote: >> >> Hello. >> >> (snip) >> >> However, it is usuall

Re: Using Python for programming algorithms

2008-05-20 Thread Bruno Desthuilliers
Henrique Dante de Almeida a écrit : On May 19, 5:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: The situation would be simpler if there were good well-known toolkits for optimization in python (like numpy for matrix operations), but that's not the case. There's at least Psyco (if you're

Re: Using Python for programming algorithms

2008-05-19 Thread Henrique Dante de Almeida
On May 19, 5:25 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > There's at least one (possibly incomplete) C interpreter. FWIW, it > would not be harder (and possibly simpler) to write a byte-code+VM > based C implementation than it is to write CPython, Jython or You may (right now, readily,

Re: Using Python for programming algorithms

2008-05-19 Thread Henrique Dante de Almeida
On May 19, 5:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On 19 mai, 17:53, Henrique Dante de Almeida <[EMAIL PROTECTED]> wrote: > > (snip) > > >  Yes, I was actually referring to statically typed JIT-compiled > > languages. Sorry about that, blame the beers that entered my digestive > >

Re: Using Python for programming algorithms

2008-05-19 Thread Henrique Dante de Almeida
On May 19, 5:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >  The situation would be simpler if there were good well-known toolkits > > for optimization in python (like numpy for matrix operations), but > > that's not the case. > > There's at least Psyco (if you're willing and able to res

Re: Using Python for programming algorithms

2008-05-19 Thread Henrique Dante de Almeida
On May 19, 3:07 pm, Vicent Giner <[EMAIL PROTECTED]> wrote: > > Yes, of course, but that should mean that I have to do it better, in > the programming step (I would have to re-program or re-implement my > algorithm). And I think the problem would be the same in any other > language, wouldn't it?

Re: Using Python for programming algorithms

2008-05-19 Thread [EMAIL PROTECTED]
On 19 mai, 17:53, Henrique Dante de Almeida <[EMAIL PROTECTED]> wrote: (snip) > Yes, I was actually referring to statically typed JIT-compiled > languages. Sorry about that, blame the beers that entered my digestive > system that night. :-P for beer in beers: if beer.entered_henrique_digestiv

Re: Using Python for programming algorithms

2008-05-19 Thread [EMAIL PROTECTED]
On 19 mai, 20:07, Vicent Giner <[EMAIL PROTECTED]> wrote: > On May 19, 6:11 pm, Henrique Dante de Almeida <[EMAIL PROTECTED]> > wrote: > (snip) > > The situation would be simpler if there were good well-known toolkits > > for optimization in python (like numpy for matrix operations), but > > that'

Re: Using Python for programming algorithms

2008-05-19 Thread [EMAIL PROTECTED]
On 19 mai, 18:11, Henrique Dante de Almeida <[EMAIL PROTECTED]> wrote: > On May 19, 7:03 am, Bruno Desthuilliers > > > [EMAIL PROTECTED]> wrote: > > Vicent Giner a écrit : > > > > Hello. > > > > I am new to Python. It seems a very interesting language to me. Its > > > simplicity is very attractive

Re: Using Python for programming algorithms

2008-05-19 Thread [EMAIL PROTECTED]
On 19 mai, 15:30, Roel Schroeven <[EMAIL PROTECTED]> wrote: > Bruno Desthuilliers schreef: > > > 1/ being interpreted or compiled (for whatever definition of these > > terms) is not a property of a language, but a property of an > > implementation of a language. > > > 2/ actually, all known Python

Re: Using Python for programming algorithms

2008-05-19 Thread Jaap Spies
Vicent Giner wrote: Thank you very much for all the answers I've got. As far as I have understood, Python can be a good alternative, or, at least, a reasonable choice. I intend to design new algorithms for a kind of Optimization problems, and then I have to implement them and show/prove that th

Re: Using Python for programming algorithms

2008-05-19 Thread Lou Pecora
In article <[EMAIL PROTECTED]>, Roel Schroeven <[EMAIL PROTECTED]> wrote: > Bruno Desthuilliers schreef: > > 1/ being interpreted or compiled (for whatever definition of these > > terms) is not a property of a language, but a property of an > > implementation of a language. > > > > 2/ actually

Re: Using Python for programming algorithms

2008-05-19 Thread Vicent Giner
On May 19, 6:11 pm, Henrique Dante de Almeida <[EMAIL PROTECTED]> wrote: > On May 19, 7:03 am, Bruno Desthuilliers > I'm pretty sure about that: when the algorithms take 4 hours to test > a single execution, you value processor time. Yes, of course, but that should mean that I have to do it be

Re: Using Python for programming algorithms

2008-05-19 Thread Vicent Giner
Thank you very much for all the answers I've got. As far as I have understood, Python can be a good alternative, or, at least, a reasonable choice. I intend to design new algorithms for a kind of Optimization problems, and then I have to implement them and show/prove that they are good enough, in

Re: Using Python for programming algorithms

2008-05-19 Thread Robin Becker
Vicent Giner wrote: Hello. I am new to Python. It seems a very interesting language to me. Its simplicity is very attractive. However, it is usually said that Python is not a compiled but interpreted programming language —I mean, it is not like C, in that sense. ... I programmed several

Re: Using Python for programming algorithms

2008-05-19 Thread Henrique Dante de Almeida
On May 19, 7:03 am, Bruno Desthuilliers wrote: > Vicent Giner a écrit : > > > Hello. > > > I am new to Python. It seems a very interesting language to me. Its > > simplicity is very attractive. > > > However, it is usually said that Python is not a compiled but > > interpreted programming language

Re: Using Python for programming algorithms

2008-05-19 Thread Henrique Dante de Almeida
On May 19, 6:52 am, Bruno Desthuilliers wrote: > Henrique Dante de Almeida a écrit : > > > On May 17, 7:32 pm, Vicent Giner <[EMAIL PROTECTED]> wrote: > >> Hello. > > (snip) > >> However, it is usually said that Python is not a compiled but > >> interpreted programming language —I mean, it is not

Re: Using Python for programming algorithms

2008-05-19 Thread Diez B. Roggisch
Roel Schroeven wrote: > Bruno Desthuilliers schreef: >> 1/ being interpreted or compiled (for whatever definition of these >> terms) is not a property of a language, but a property of an >> implementation of a language. >> >> 2/ actually, all known Python implementations compile to byte-code. >>

Re: Using Python for programming algorithms

2008-05-19 Thread Roel Schroeven
Bruno Desthuilliers schreef: 1/ being interpreted or compiled (for whatever definition of these terms) is not a property of a language, but a property of an implementation of a language. 2/ actually, all known Python implementations compile to byte-code. You keep saying that, and in theory

Re: Using Python for programming algorithms

2008-05-19 Thread Bruno Desthuilliers
Tim Golden a écrit : Bruno Desthuilliers wrote: 2/ actually, all known Python implementations compile to byte-code. In curiosity, did your "actually" mean, in the French sense, "at the moment" or, in the English sense, "in contrast to something stated earlier"? Or maybe both? I mainly inte

Re: Using Python for programming algorithms

2008-05-19 Thread Tim Golden
Bruno Desthuilliers wrote: 2/ actually, all known Python implementations compile to byte-code. In curiosity, did your "actually" mean, in the French sense, "at the moment" or, in the English sense, "in contrast to something stated earlier"? Or maybe both? TJG -- http://mail.python.org/mailma

Re: Using Python for programming algorithms

2008-05-19 Thread Bruno Desthuilliers
Vicent Giner a écrit : Hello. I am new to Python. It seems a very interesting language to me. Its simplicity is very attractive. However, it is usually said that Python is not a compiled but interpreted programming language cf my answer to you and Henrique on this. I am working on my PhD T

Re: Using Python for programming algorithms

2008-05-19 Thread Bruno Desthuilliers
Henrique Dante de Almeida a écrit : On May 17, 7:32 pm, Vicent Giner <[EMAIL PROTECTED]> wrote: Hello. (snip) However, it is usually said that Python is not a compiled but interpreted programming language —I mean, it is not like C, in that sense. (snip) I guess that python is not a good la

Re: Using Python for programming algorithms

2008-05-18 Thread Jaap Spies
Vicent Giner wrote: Hello. I am new to Python. It seems a very interesting language to me. Its simplicity is very attractive. However, it is usually said that Python is not a compiled but interpreted programming language —I mean, it is not like C, in that sense. I am working on my PhD Thesis,

Re: Using Python for programming algorithms

2008-05-18 Thread sturlamolden
On May 18, 4:20 pm, David C. Ullrich <[EMAIL PROTECTED]> wrote: > Are you going to be doing research _about_ the > algorithms in question or is it going to be research > _using_ these algorithms to draw conclusions > about other things? > > Most of the replies seem to be assuming the latter. > If

Re: Using Python for programming algorithms

2008-05-18 Thread David C. Ullrich
On Sat, 17 May 2008 15:32:29 -0700 (PDT), Vicent Giner <[EMAIL PROTECTED]> wrote: >Hello. > >I am new to Python. It seems a very interesting language to me. Its >simplicity is very attractive. > >However, it is usually said that Python is not a compiled but >interpreted programming language —I mea

Re: Using Python for programming algorithms

2008-05-18 Thread sturlamolden
On May 18, 5:46 am, "inhahe" <[EMAIL PROTECTED]> wrote: > The numbers I heard are that Python is 10-100 times slower than C. Only true if you use Python as if it was a dialect of Visual Basic. If you use the right tool, like NumPy, Python can be fast enough. Also note that Python is not slower th

Re: Using Python for programming algorithms

2008-05-18 Thread dmitrey
Along with numpy & scipy there is some more Python scientific soft worse to be mentioned: http://scipy.org/Topical_Software http://pypi.python.org/pypi?:action=browse&show=all&c=385 On 18 Тра, 06:25, Henrique Dante de Almeida <[EMAIL PROTECTED]> wrote: > once I > looked for linear programming too

Re: Using Python for programming algorithms

2008-05-18 Thread Lie
On May 18, 5:32 am, Vicent Giner <[EMAIL PROTECTED]> wrote: > Hello. > > I am new to Python. It seems a very interesting language to me. Its > simplicity is very attractive. > > However, it is usually said that Python is not a compiled but > interpreted programming language —I mean, it is not like

Re: Using Python for programming algorithms

2008-05-17 Thread inhahe
what little I know: The numbers I heard are that Python is 10-100 times slower than C. So use Python if you can wait 10-100 times longer. Although it won't really be that slow using numpy and/or psyco. Python seems to have a really extensive reportoire of modules available for it. Although

Re: Using Python for programming algorithms

2008-05-17 Thread Henrique Dante de Almeida
On May 17, 7:32 pm, Vicent Giner <[EMAIL PROTECTED]> wrote: > Hello. > > I am new to Python. It seems a very interesting language to me. Its > simplicity is very attractive. > > However, it is usually said that Python is not a compiled but > interpreted programming language —I mean, it is not like

Re: Using Python for programming algorithms

2008-05-17 Thread sturlamolden
On May 18, 12:32 am, Vicent Giner <[EMAIL PROTECTED]> wrote: > * As far as I understand, the fact that Python is not a compiled > language makes it slower than C, when performing huge amounts of > computations within an algorithm or program. First of all: whatever you do, use NumPy for all numeri

Re: Using Python for programming algorithms

2008-05-17 Thread Vicent Giner
> > The usual answer is that development > time is more important than running time. OK, thank you for your answer. I just wanted to check if it was a naive idea trying to use Python instead of C in order to implement my own algorithms, and other research-related code. > > Since you are likely

Re: Using Python for programming algorithms

2008-05-17 Thread castironpi
On May 17, 5:32 pm, Vicent Giner <[EMAIL PROTECTED]> wrote: > Hello. > > I am new to Python. It seems a very interesting language to me. Its > simplicity is very attractive. > > However, it is usually said that Python is not a compiled but > interpreted programming language —I mean, it is not like

Re: Using Python for programming algorithms

2008-05-17 Thread Colin J. Williams
Vicent Giner wrote: Hello. I am new to Python. It seems a very interesting language to me. Its simplicity is very attractive. However, it is usually said that Python is not a compiled but interpreted programming language —I mean, it is not like C, in that sense. I am working on my PhD Thesis,

Using Python for programming algorithms

2008-05-17 Thread Vicent Giner
Hello. I am new to Python. It seems a very interesting language to me. Its simplicity is very attractive. However, it is usually said that Python is not a compiled but interpreted programming language —I mean, it is not like C, in that sense. I am working on my PhD Thesis, which is about Operati