[Tutor] Const on Python

Alan Gauld alan.gauld at btinternet.com
Fri Mar 7 22:13:07 CET 2008


"Kent Johnson" <kent37 at tds.net> wrote in

> (Jumping in against my better judgment :-)

:-)

> Hmm...sure, programming is not about typing, it is about figuring 
> out
> what to type. With Python the conceptual activity takes place at a
> higher level because - Python provides easy-to-use, high-level
> constructs like lists, dicts and first-order functions
> - Python doesn't require you to think about low-level details like
> const, private, getters and setters, braces, etc.

Yes but thats not the bit that takes time in my experience its
trying to understand the problem. What exactly am I trying to
do here? Is it a suimulation exercise, a database problem?
A real-time or networking issue? Should my solution include
security protection? If so how much? Can I use a standard
sort or do i need a custom algorithm? And if so what is it?

Designing an algorithm takes far longer than converting it to
code in any language.

> So Python speeds up the thinking part.

It speeds up the thinking abouit code bit, it doesn't help much
in the thining about the problem part.

> As far as the code, those 20-100 lines will do more if they are in
> Python than they will if they are in Java or C++.

Absolutely, thats why I write in Python and let the developers
do the Java stuff - life is too short! And thats why I am on a
Python mailing list not a Java one :-)

> I don't see an order of magnitude difference between
> Python and Java

And thats my point, particularly for bigger projects where
the problem complexity completely dominates the code
complexity. The coding time will derinitely improve and I
suspect you could get as high as 4 or 5 times but I doubt
if you'd ever really achieve an order of magnitude.

> have compared code samples, I have found Python code
> to be 20-60% the size of equivalent Java code.

In the few cases I've measured its been about 30% less
which nearly falls into your range. But the examples were very
small - all less than 1000 lines of Java - about as much
Java as I can bring myself to type!

Alan G. 




More information about the Tutor mailing list