Is Python really a scripting language?

mensanator at aol.com mensanator at aol.com
Fri Dec 14 15:09:33 EST 2007


On Dec 11, 10:34 pm, "Terry Reedy" <tjre... at udel.edu> wrote:
> "Ron Provost" <ron.lo... at cox.net> wrote in message
>
> news:009101c83c55$4ee07a00$6501a8c0 at aristotle...
> But here's my problem, most of my coworkers, when they see my apps and
> learn that they are written in Python ask questions like, "Why would you
> write that in a scripting language?"  Whenever I hear a comment like that I
> can feel myself boiling inside.
> ===================
>
> I don't blame you.  Python is an full-fledged algorithm/programming
> language that was designed to *also* be used a scripting language.

When you buy a new car, which is more important, the styling
or what's under the hood?

Take, for example, Microsoft's slick new language F#.

<Wikipedia>
F# (pronounced F Sharp) is a multi-paradigm programming language,
targeting the .NET Framework, that encompasses functional programming
as well as imperative object-oriented programming disciplines.
It is a variant of ML and is largely compatible with the OCaml
implementation.
</Wikipedia>

Sounds pretty sexy, eh? And programs compile to .exe files, none
of that byte-code interpretation nonsense.

But you would never buy a car without taking a test drive, right?

So we can fire up the F# Interactive (Console) and put it in gear.

> #time;;

--> Timing now on

> open Math;;

Time 0.046875
> let mutable Z = 0I;;

val mutable Z : bigint

Time 0.156250
> Z <- Z + (BigInt.pow 3I 123295I) * (BigInt.pow 2I 0I);;
val it : unit = ()
Time 0.515625
>

About a half second to compute a number with 58827 decimal digits.

OTOH, that was only the first of 123296 terms. The time to compute
the full sequence is 0.515625*123296 seconds or 17.65 hours.

If it takes that long for a compiled .exe to run, just imagine how
long a lowly, byte-code interpreted language would take!

But wait...

...we don't have to imagine, we can take the Python out for a test
drive also.


>>> import collatz_functions
>>> import time
>>> sv = collatz_functions.build_sv(19,19,1000000,1541095)
>>> def Big_Z(sv):
	Z = 0
	e2 = 0
	e3 = len(sv) - 1
	t0 = time.time()
	for v in sv:
		Z += 3**e3 * 2**e2
		e3 -= 1
		e2 += v
	t1 = time.time()
	print (t1-t0)/60,'minutes'

>>> Big_Z(sv)
25.6775999983 minutes

Hold on...

That's for the whole sequence, not a single term!

25.67 MINUTES compared to 17.65 HOURS!

So, sure, some languages compile to .exe programs.

In the trade, we call that "polishing a turd".



More information about the Python-list mailing list