Re: OT: Code Examples

2011-03-09 Thread Erik de Castro Lopo
Erik de Castro Lopo wrote:

> Paul Rubin wrote:
>
> > Anyway, try googling "evil mangler"
> 
> I know what the "evil mangler" is. It was called that because it
> threw away all the principles of good software design in favour
> of expediency. GHC now has a new LLVM backend which does not
> depend on the evil mangler and I strongly suspect that the backend
> which uses the evil mangler will be dumped in the next year or
> two.

I have some more information about the replacement of the Evil
Mangler. According to this paper:

   http://llvm.org/pubs/2010-09-HASKELLSYM-LLVM-GHC.pdf

the new LLVM backend for the GHC compiler still has a mangler
phase, but the new LLVM Mangler is 180 lines of heavily
commented Haskell code which replaces a 2000 lines of poorly 
commented Perl script.

Full disclosure: the Perl mangler needs to parse the GNU assembler
code while the Haskell mangler only needs to operate on data
structures already defined elesewhere. However, the Evil Mangler
only handled a small subset of CPU architectures, while the new
LLM Mangler works on the architecture independent LLVM intermediate
representation.

> > and ask why it wasn't done in Haskell.  Same idea.
> 
> Expediency over common sense?

Ignoring the parsing issue, this shows that Haskell was
certainly up to the task of doing everything the Evil 
Mangler was doing.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Code Examples

2011-03-03 Thread Chris Jones
On Thu, Mar 03, 2011 at 02:29:54PM EST, Emile van Sebille wrote:
> On 3/1/2011 3:59 PM Chris Jones said...
>> On Tue, Mar 01, 2011 at 12:03:02PM EST, Emile van Sebille wrote:
 
>>> On 3/1/2011 12:43 AM Erik de Castro Lopo said...
>>
 Why Python?
>>>
>>> For me?  Because it's executable pseudocode
>>
>> Not for nothing, Emile.. hey.. you could end up with pseudo bugs and
>> pseudo headaches ..
>>
>
> Ah -- that's why there's Pseudoephedrine...
>
> :)

Ah yes..!! Excellent..!

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


Re: OT: Code Examples

2011-03-03 Thread Emile van Sebille

On 3/1/2011 3:59 PM Chris Jones said...

On Tue, Mar 01, 2011 at 12:03:02PM EST, Emile van Sebille wrote:

On 3/1/2011 12:43 AM Erik de Castro Lopo said...



Why Python?


For me?  Because it's executable pseudocode


Not for nothing, Emile.. hey.. you could end up with pseudo bugs and
pseudo headaches ..



Ah -- that's why there's Pseudoephedrine...

:)



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


Re: OT: Code Examples

2011-03-02 Thread Martin De Kauwe
On Mar 2, 3:30 am, Robert Kern  wrote:
> On 2/28/11 10:03 AM, Fred Marshall wrote:
>
> > I'm interested in developing Python-based programs, including an engineering
> > app. ... re-writing from Fortran and C versions. One of the objectives 
> > would to
> > be make reasonable use of the available structure (objects, etc.). So, I'd 
> > like
> > to read a couple of good, simple scientific-oriented programs that do that 
> > kind
> > of thing.
>
> You may want to take a look at Clear Climate Code. It is a rewrite of an old,
> hairy FORTRAN climate analysis program with the goal of making it clearer and
> easier to understand. That's somewhat different from having an example of what
> you would write de novo, but it might help give you strategies for the process
> of translating your own FORTRAN and C engineering codes.
>
>    http://clearclimatecode.org/
>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless enigma
>   that is made terrible by our own mad attempt to interpret it as though it 
> had
>   an underlying truth."
>    -- Umberto Eco

that link is really useful helps that it is the same field! Does
anyone have any more like that?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Code Examples

2011-03-01 Thread Dan Stromberg
On Tue, Mar 1, 2011 at 8:51 AM, Erik de Castro Lopo wrote:

> Definitely not. As I said I used Python for a number of years
> and ditched it in favour of Ocaml and Haskell.
>
These are all 3 intriguing languages.  I wish I had time to learn OCaML and
Haskell, and I wish one or both of them were near gaining critical mass.  I
suspect it'll take one of them becoming implicitly parallel for that to
happen.

The ease of development and high level language features of
> Python look really good if all you know is C, C++ and Java.
> The big difference Python and those three languages is that
> there are a huge number of classes of bugs which are run time
> errors in Python but compile time errors in C/C++/Java.
>
> I will always chose compile time errors over run time errors.
>
Yes, me too.  But of course, python has pylint, pyflakes and pychecker,
which make short work of what would be compile-time errors in statically
typed languages.  For any serious python programming, I use pylint - often
even on my unit tests, which of course themselves also catch many blunders.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Code Examples

2011-03-01 Thread Chris Jones
On Tue, Mar 01, 2011 at 12:03:02PM EST, Emile van Sebille wrote:
> On 3/1/2011 12:43 AM Erik de Castro Lopo said...

>> Why Python?
>
> For me?  Because it's executable pseudocode

Not for nothing, Emile.. hey.. you could end up with pseudo bugs and
pseudo headaches ..

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


Re: OT: Code Examples

2011-03-01 Thread mblume
Am Mon, 28 Feb 2011 08:03:01 -0800 schrieb Fred Marshall:

> I'm interested in developing Python-based programs, including an
> engineering app. ... re-writing from Fortran and C versions.  One of the
> objectives would to be make reasonable use of the available structure
> (objects, etc.).  So, I'd like to read a couple of good, simple
> scientific-oriented programs that do that kind of thing.
> 
> Looking for links, etc.
> 
> Fred

An execellent book in this domain is
"Python Scripting for Computational Science"
by Hans Petter Langtangen

Springer, ISBN 3-450-43508-5

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


Re: OT: Code Examples

2011-03-01 Thread Tom Zych
geremy condra  wrote:
> Ah, so you're looking for an argument. This is abuse, you want room
> 12A just down the hall.

They have comfy chairs there. No one expects it.

-- 
Tom Zych / freethin...@pobox.com
Quidquid latine dictum sit, altum viditur.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Code Examples

2011-03-01 Thread geremy condra
On Tue, Mar 1, 2011 at 9:11 AM, Erik de Castro Lopo  wrote:
> Paul Rubin wrote:
>
>> Erik de Castro Lopo  writes:
>> > Why Python? I really can't understand the rush of every man and
>> > his dog to Python.
>>
>> Are you trolling?
>
> All my responses to this thread are really mean for comp.dsp,
> not for comp.lang.python.

Ah, so you're looking for an argument. This is abuse, you want room
12A just down the hall.

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


Re: OT: Code Examples

2011-03-01 Thread Erik de Castro Lopo
Paul Rubin wrote:

> Erik de Castro Lopo  writes:
> > Why Python? I really can't understand the rush of every man and
> > his dog to Python.
> 
> Are you trolling?

All my responses to this thread are really mean for comp.dsp,
not for comp.lang.python.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Code Examples

2011-03-01 Thread Emile van Sebille

On 3/1/2011 12:43 AM Erik de Castro Lopo said...

Why Python?


For me?  Because it's executable pseudocode

Emile

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


Re: OT: Code Examples

2011-03-01 Thread Erik de Castro Lopo
Paul Rubin wrote:

> Erik de Castro Lopo  writes:
> > Why Python? I really can't understand the rush of every man and
> > his dog to Python.
> 
> Are you trolling?

Definitely not. As I said I used Python for a number of years
and ditched it in favour of Ocaml and Haskell.

The ease of development and high level language features of
Python look really good if all you know is C, C++ and Java.
The big difference Python and those three languages is that
there are a huge number of classes of bugs which are run time
errors in Python but compile time errors in C/C++/Java.

I will always chose compile time errors over run time errors.

> Anyway, try googling "evil mangler"

I know what the "evil mangler" is. It was called that because it
threw away all the principles of good software design in favour
of expediency. GHC now has a new LLVM backend which does not
depend on the evil mangler and I strongly suspect that the backend
which uses the evil mangler will be dumped in the next year or
two.

> and ask why it wasn't done in Haskell.  Same idea.

Expediency over common sense?

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Code Examples

2011-03-01 Thread Robert Kern

On 2/28/11 10:03 AM, Fred Marshall wrote:

I'm interested in developing Python-based programs, including an engineering
app. ... re-writing from Fortran and C versions. One of the objectives would to
be make reasonable use of the available structure (objects, etc.). So, I'd like
to read a couple of good, simple scientific-oriented programs that do that kind
of thing.


You may want to take a look at Clear Climate Code. It is a rewrite of an old, 
hairy FORTRAN climate analysis program with the goal of making it clearer and 
easier to understand. That's somewhat different from having an example of what 
you would write de novo, but it might help give you strategies for the process 
of translating your own FORTRAN and C engineering codes.


  http://clearclimatecode.org/

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

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


Re: OT: Code Examples

2011-03-01 Thread Nicholas Devenish

On 01/03/2011 09:24, Richard Dobson wrote:

But - I am ~still~ caught out by the
semantic significance of indenting. Looks OK enough on paper, but doing
it interactively is another matter.


I still don't fully understand this argument. With Python, I am still 
doing indentation almost exactly the same way I was in any other 
language (and should be - I haven't ever seen any arguments for not 
indenting logical blocks).


The only difference is, I don't need to put a block-end-identifier.

I suppose I see how one could argue that this could potentially cause 
*mildly* confusing code, but only in extreme examples, and mainly only 
for multi-screen functions, that should rarely exist (and these are 
confusing even with bracketed blocks).

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


Re: OT: Code Examples

2011-03-01 Thread Martin De Kauwe
On Mar 1, 3:03 am, Fred Marshall 
wrote:
> I'm interested in developing Python-based programs, including an
> engineering app. ... re-writing from Fortran and C versions.  One of the
> objectives would to be make reasonable use of the available structure
> (objects, etc.).  So, I'd like to read a couple of good, simple
> scientific-oriented programs that do that kind of thing.
>
> Looking for links, etc.
>
> Fred

you could try searching here http://pypi.python.org/pypi. I had a look
for models, but didn't find anything in particular. But would be
really useful if anyone does know of some good examples
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Code Examples

2011-03-01 Thread Tom Zych
Erik de Castro Lopo wrote:
> Why Python? I really can't understand the rush of every man and
> his dog to Python.
> Its not that I'm a stick in the mud stuck with C and C++, rather
> that I used Python for a number of years from 1998 to 2004 and
> rejected it in favour of strict statically typed functional
> langauges like Ocaml and Haskell.

Hmm, if we abused this guy enough for his heresy, do you think
he'd say he didn't expect the Spanish Inquisition? Then we could
riff on that theme for days :-D

-- 
Tom Zych / freethin...@pobox.com
Quidquid latine dictum sit, altum viditur.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Code Examples

2011-03-01 Thread Paul Rubin
Erik de Castro Lopo  writes:
> Why Python? I really can't understand the rush of every man and
> his dog to Python.

Are you trolling?  Anyway, try googling "evil mangler" and ask why it
wasn't done in Haskell.  Same idea.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Code Examples

2011-03-01 Thread Richard Dobson

On 01/03/2011 08:43, Erik de Castro Lopo wrote:

Fred Marshall wrote:


I'm interested in developing Python-based programs, including an
engineering app. ... re-writing from Fortran and C versions.  One of the
objectives would to be make reasonable use of the available structure
(objects, etc.).  So, I'd like to read a couple of good, simple
scientific-oriented programs that do that kind of thing.


Why Python? I really can't understand the rush of every man and
his dog to Python.

Its not that I'm a stick in the mud stuck with C and C++, rather
that I used Python for a number of years from 1998 to 2004 and
rejected it in favour of strict statically typed functional
langauges like Ocaml and Haskell.



My understanding is/was that Guido originally proposed Python as the 
replacement for BASIC; i.e. to be the new first language students at 
school would be exposed to. So rather than compare it to C and C++, I 
suppose one should, strategically speaking, compare it to Visual Basic 
and/or Java.


The other aspect is purely pragmatic - it has bindings for tk, MIDI and 
audio (and of course Csound as you know), which adds up to a fairly 
hefty scripting package complete with GUI design options - great for 
"knocking up stuff quickly". But - I am ~still~ caught out by the 
semantic significance of indenting. Looks OK enough on paper, but doing 
it interactively is another matter.



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


Re: OT: Code Examples

2011-03-01 Thread Erik de Castro Lopo
Fred Marshall wrote:

> I'm interested in developing Python-based programs, including an 
> engineering app. ... re-writing from Fortran and C versions.  One of the 
> objectives would to be make reasonable use of the available structure 
> (objects, etc.).  So, I'd like to read a couple of good, simple 
> scientific-oriented programs that do that kind of thing.

Why Python? I really can't understand the rush of every man and
his dog to Python.

Its not that I'm a stick in the mud stuck with C and C++, rather
that I used Python for a number of years from 1998 to 2004 and
rejected it in favour of strict statically typed functional
langauges like Ocaml and Haskell.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Code Examples

2011-02-28 Thread Fred Marshall

On 2/28/2011 8:14 AM, n00m wrote:

On Feb 28, 6:03 pm, Fred Marshall
wrote:



The best place for you to start: http://numpy.scipy.org/

Numpy manual: http://www.tramy.us/numpybook.pdf


OK Thanks!

Fred

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


Re: OT: Code Examples

2011-02-28 Thread n00m
On Feb 28, 6:03 pm, Fred Marshall 
wrote:
> I'm interested in developing Python-based programs, including an
> engineering app. ... re-writing from Fortran and C versions.  One of the
> objectives would to be make reasonable use of the available structure
> (objects, etc.).  So, I'd like to read a couple of good, simple
> scientific-oriented programs that do that kind of thing.
>
> Looking for links, etc.
>
> Fred

The best place for you to start: http://numpy.scipy.org/

Numpy manual: http://www.tramy.us/numpybook.pdf
-- 
http://mail.python.org/mailman/listinfo/python-list


OT: Code Examples

2011-02-28 Thread Fred Marshall
I'm interested in developing Python-based programs, including an 
engineering app. ... re-writing from Fortran and C versions.  One of the 
objectives would to be make reasonable use of the available structure 
(objects, etc.).  So, I'd like to read a couple of good, simple 
scientific-oriented programs that do that kind of thing.


Looking for links, etc.

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