Python development time is faster.

C

Chris Brat

I've seen a few posts, columns and articles which state that one of the
advantages of Python is that code can be developed x times faster than
languages such as <<Insert popular language name here>>.

Does anyone have any comments on that statement from personal
experience?
How is this comparison measured?


Thanks
Chris
 
F

Fredrik Lundh

Chris said:
I've seen a few posts, columns and articles which state that one of the
advantages of Python is that code can be developed x times faster than
languages such as <<Insert popular language name here>>.

Does anyone have any comments on that statement from personal
experience?

have you tried writing something in Python, or are you just asking around to
see if it's worth the effort to download it and play with it a little?

</F>
 
P

Paddy

Chris said:
I've seen a few posts, columns and articles which state that one of the
advantages of Python is that code can be developed x times faster than
languages such as <<Insert popular language name here>>.

Does anyone have any comments on that statement from personal
experience?
How is this comparison measured?


Thanks
Chris
Here's a start:
http://www.tcl.tk/doc/scripting.html

Go Googling. There's a paper out their that compares error rates and
time to program, lines of code, for several languages and is often
cited in defence of scripting languages. (Scripting languages have
however moved on and now like to be called dynamic languages).

- Pad.
 
C

Chris Brat

I work full time with Java, but downloaded python about a year ago and
started playing.

I've used it quite a few times in my working environment.
 
H

Harry George

Chris Brat said:
I've seen a few posts, columns and articles which state that one of the
advantages of Python is that code can be developed x times faster than
languages such as <<Insert popular language name here>>.

Does anyone have any comments on that statement from personal
experience?
How is this comparison measured?


Thanks
Chris

Personal experience takes two forms.

1. Broad experience with languages, such that doing a single project
in a new language gives a sense of the relative power and
ease-of-use. Everyone I know who is a strong Python supporter took
that route. There was an Ahh-Ha experience part way into the first
project. This includes folks who could charitably be called
curmudgeons, and people who are truely fluent in, say, C++ or Lisp.

For these people the main success factor is that "it just works".
You spend time on new functionality, or experimenting with
alternative algorithms, not on debugging. Of course, we work in a
regression-test-driven world, so we don't pile up a lot of untested
code and then hope for the best. Python facilitates that
test-early-test-often approach with its modularity and fast
edit-run cycle.

2. Write the same thing in 2 or more languages. Due to machine
migrations and project redirections I have done that with
perl-and-python, java-and-python, modula3-and-python,
lisp-and-python. In all cases, python was the second language, so
there is some learning curve to be adjusted for (i.e., I understood
the semantics better). However, since I've done some
perl-and-perl, and lisp-and-lisp, I can maybe make that adjustment.

The result was that python was relatively faster-to-develop. I
can't give a specific speedup factor, but I sure can say Python is
now my default language. The success factors were:

a) Once you get the hang of the language (a weekend?), you can
write without reference to the manuals. Or if you do reference, it
is a quick lookup. No struggling to figure out how to code
something. Or to decypher what a line of code actually does.

b) The project doesn't bog down as you add features. The language
can accomodate new paradigms, patterns, or major functionality. If
you do need to refactor, that is easy too.

c) Peer code reviews are easy -- both you and the reviewers can
understand the code's intent at a glance.
 
S

Steven Bethard

Chris said:
I've seen a few posts, columns and articles which state that one of the
advantages of Python is that code can be developed x times faster than
languages such as <<Insert popular language name here>>.

Does anyone have any comments on that statement from personal
experience?

I had to work at a laboratory a few years ago which used Java
exclusively. I was coming from several years as a graduate student
using Python almost exclusively for my own work. (But I used to teach
introductory Java classes at my previous university, so I had plenty of
Java experience.)

My own work and the work that I did for the lab were quite similar,
mainly focused on training machine learning models on natural language
processing tasks. I estimated that the Java code took me about 5x as
long. Part of this is the verbosity of Java, e.g. where you have to
write an anonymous inner class instead of using a function or a class
object directly. But probably a larger part of this was using the Java
libraries, which tend to be way over-engineered, and more complicated to
use than they need to be.

A simple example from document indexing. Using Java Lucene to index
some documents, you'd write code something like::

Analyzer analyzer = new StandardAnalyzer()
IndexWriter writer = new IndexWriter(store_dir, analyzer, true)
for (Value value: values) {
Document document = Document()
Field title = new Field("title", value.title,
Field.Store.YES,
Field.Index.TOKENIZED)
Field text = new Field("text", value.text,
Field.Store.YES,
Field.Index.TOKENIZED)
document.add(title)
document.add(text)
}

Why is this code so verbose? Because the Lucene Java APIs don't like
useful defaults. So for example, even though StandardAnalyzer is
supposedly *Standard*, there's no IndexWriter constructor that includes
it automatically. Similarly, if you create a Field with a string name
and value (as above), you must specify both a Field.Store and a
Field.Index - there's no way to let them default to something reasonable.

Compare this to Python code. Unfortunately, PyLucene wraps the Lucene
APIs pretty directly, but I've wrapped PyLucene with my own wrapper that
adds useful defaults (and takes advantages of things like Python's
**kwargs). Here's what the same code looks like with my Python wrapper
to Lucene::

writer = IndexWriter(store_dir)
for value in values:
document = Document(title=value.title, text=value.text)
writer.addDocument(document)
writer.close()

Gee, and I wonder why it took me so much longer to write things in Java. ;-)


STeVe
 
G

George Sakkis

Steven said:
A simple example from document indexing. Using Java Lucene to index
some documents, you'd write code something like::

Analyzer analyzer = new StandardAnalyzer()
IndexWriter writer = new IndexWriter(store_dir, analyzer, true)
for (Value value: values) {
Document document = Document()
Field title = new Field("title", value.title,
Field.Store.YES,
Field.Index.TOKENIZED)
Field text = new Field("text", value.text,
Field.Store.YES,
Field.Index.TOKENIZED)
document.add(title)
document.add(text)
}

Why is this code so verbose? Because the Lucene Java APIs don't like
useful defaults. So for example, even though StandardAnalyzer is
supposedly *Standard*, there's no IndexWriter constructor that includes
it automatically. Similarly, if you create a Field with a string name
and value (as above), you must specify both a Field.Store and a
Field.Index - there's no way to let them default to something reasonable.

Compare this to Python code. Unfortunately, PyLucene wraps the Lucene
APIs pretty directly, but I've wrapped PyLucene with my own wrapper that
adds useful defaults (and takes advantages of things like Python's
**kwargs). Here's what the same code looks like with my Python wrapper
to Lucene::

writer = IndexWriter(store_dir)
for value in values:
document = Document(title=value.title, text=value.text)out two
writer.addDocument(document)
writer.close()

Gee, and I wonder why it took me so much longer to write things in Java. ;-)

Oh, the memories... I went down the same road about two years ago,
though I didn't know about PyLucene at the time and wrapped in jython
the parts of Lucene I used... never bothered to deal with java's
verbosity after that. It's a pity that jython resembles abandon-ware
these days, when jRuby showed up pretty recently and is gaining in
penetration with the java crowd. It will be a non-trivial loss for
python if it is left behind in the JVM world (at least if the latter is
not swallowed by the .NET dark forces, which doesn't seem to happen any
time soon ;-).

George
 
D

Diez B. Roggisch

Oh, the memories... I went down the same road about two years ago,
though I didn't know about PyLucene at the time and wrapped in jython
the parts of Lucene I used... never bothered to deal with java's
verbosity after that. It's a pity that jython resembles abandon-ware
these days, when jRuby showed up pretty recently and is gaining in
penetration with the java crowd. It will be a non-trivial loss for
python if it is left behind in the JVM world (at least if the latter is
not swallowed by the .NET dark forces, which doesn't seem to happen any
time soon ;-).

I wouldn't consider jython abandonware. It is under active development, and
I'm using a 2.2 alpha successful for quite a while now - which usually
serves my needs.

The problem is/was that new-style classes were a major hurdle to take, and
this now seems to be conquered. So lets hope (or contribute code....:p)
that jython will see a 2.4 version ASAP.

diez
 
E

Egon Frerich

Chris said:
I've seen a few posts, columns and articles which state that one of the
advantages of Python is that code can be developed x times faster than
languages such as <<Insert popular language name here>>.

Does anyone have any comments on that statement from personal
experience?
How is this comparison measured?


Thanks
Chris
Have a lookl at
http://wwwipd.ira.uka.de/EIR/otherwork/index.html
 
F

flit

One thing I really like, is making "prototypes" on python.
Just to test some algorithm or procedure.
It is very fast and easy to debug.
So after, I make it in c++ (but not too much often, I leave it in
python today.)
 
S

Stefan Behnel

Diez B. Roggisch wrote
I wouldn't consider jython abandonware. It is under active development, and
I'm using a 2.2 alpha successful for quite a while now - which usually
serves my needs.

The problem is/was that new-style classes were a major hurdle to take, and
this now seems to be conquered. So lets hope (or contribute code....:p)
that jython will see a 2.4 version ASAP.

The jython project currently deploys a pretty cathedral-ish development style,
pretty much hidden from broader audiences. FWIW, it seems to be stuck in
trying to get out a 2.2 compliant release first, then to provide a 2.3
compliant version (at least, there's a branch for it). Guess it's a question
of human resources, but personally, I wouldn't care too much about
compatibility and just let people go and implement whatever feature they want
to be in on the way towards something as close to 2.5 (or maybe 2.4, why not)
as possible. Honestly, how many important Python modules do still run on 2.2?
Most switched to at least 2.3 quite a while ago.

After all, it's the compatible *software* that makes the difference, not the
platform. It's easier to say: "hey, this feature is lacking to make my program
run" than: "let's see, what else is there in that outdated specification to
implement?". And it's a lot more encouraging, too.

Just my little rant on this one ...

Stefan
 
C

Carsten Haese

Honestly, how many important Python modules do still run on 2.2?

InformixDB still compiles on 2.2 except when I accidentally temporarily
break backwards compatibility.

Of course it's a matter of opinion whether it qualifies as an important
module. ;-)

-Carsten
 
S

Steve Holden

Carsten said:
InformixDB still compiles on 2.2 except when I accidentally temporarily
break backwards compatibility.

Of course it's a matter of opinion whether it qualifies as an important
module. ;-)
I think you will find that most of Fredrik Lundh's stuff will work on
1.5.2. He sets a fine example to us all.

regards
Steve
 
G

Guest

Steve Holden:
I think you will find that most of Fredrik Lundh's stuff will work on
1.5.2. He sets a fine example to us all.

1.5.2? Come on, it's 7 years old. Back then PHP was still at 3.0, Java
was at 1.2 (and compiling Hello World took over 5 minutes), Google was
nothing more than a search engine (still Beta at the time!).

What do we have all these cool new language features for if it's
considered bad behaviour to actually use them?

OK, I see the point in being compatible with Python 2.1 (well, maybe 2.2
with new-style classes and __descriptors__), just like it's still useful
to be Java 1.4 compatible and PHP 4 compatible.

But Python 1.5.2? From the official site: "*Do yourself a favor* and get
a more recent version!" ;-) It doesn't even have string methods. Today
Python 1.5.2 is being implemented on one-chip GSM modules (
http://www.telit.co.it/product.asp?productId=96 ). And yes, it actually
works quite well there :)

Regards,
Åukasz Langa
 
S

Steve Holden

Åukasz Langa said:
Steve Holden:

1.5.2? Come on, it's 7 years old. Back then PHP was still at 3.0, Java
was at 1.2 (and compiling Hello World took over 5 minutes), Google was
nothing more than a search engine (still Beta at the time!).

What do we have all these cool new language features for if it's
considered bad behaviour to actually use them?

OK, I see the point in being compatible with Python 2.1 (well, maybe 2.2
with new-style classes and __descriptors__), just like it's still useful
to be Java 1.4 compatible and PHP 4 compatible.

But Python 1.5.2? From the official site: "*Do yourself a favor* and get
a more recent version!" ;-) It doesn't even have string methods. Today
Python 1.5.2 is being implemented on one-chip GSM modules (
http://www.telit.co.it/product.asp?productId=96 ). And yes, it actually
works quite well there :)
And thanks to Fredrik there's a chance you'll be able to use PIL there.

regards
Steve
 
H

Hendrik van Rooyen

I've seen a few posts, columns and articles which state that one of the
advantages of Python is that code can be developed x times faster than
languages such as <<Insert popular language name here>>.

Does anyone have any comments on that statement from personal
experience?
How is this comparison measured?

I don't think it can be, objectively - comparing two teams, one using language
"a", and the other python, to do a task, is simply comparing the skill levels
of the two teams - and using the same team to do the same task in two different
languages is also misleading, because of the experience gained in the first
iteration.

Python is actually astonishing - it seems to "fit the brain" of a large number
of people - it is very easy to get started with, and is rich enough to keep
surprising you - even after considerable time hacking around with it.
It can do OO, but you can also write procedures in it, and you can even mix the
two in the same module, and most of the time it "just works" - and when it
doesn't, it is normally very easy to teach yourself what you are doing wrong by
playing at the interactive interpreter prompt. This makes for productivity, as
you can write quite complex things in a day or so, from scratch, such as:

A single pass "assembler" for a virtual machine with 33 instructions - from
nothing to running, fully debugged, in two days.

A simple sliding window protocol - coded up from nothing in four days - mostly
spent staring into space, imagining problems, instead of coding... so the
"design" time is included... but its not working yet, as I have to write the
other side in assembler on a very small machine, which would normally have taken
me almost a month, but that will now probably take about two weeks, as I have
the Python code to translate...

And I am not a guru on this group, and I have just idly mucked around with
Python for about a year in real time, not doing it full time, or making any real
effort to study the language formally beyond lurking here - there are other
people here on this group who, I am sure, could beat the hell out of these
times, both for the design and the coding.

So to sum up my personal perspective - it is very worth while to know a little
python, even if you just use it as a prototyping language - it gets you going
rapidly...

- Hendrik
 
J

Jordan

Just a little something I realized after writing the same program in
C++ and python (a simple chat client and server, with one on one and
chat room capabilities). I used wxwidgets and wxpython respectively
for the GUIs, and they weren't extremely elaborate, just some basic
functionality, a few frames, a few buttons, added a few sound
options... nothing huge ;D However, making the gui for python took me
less than a fourth of the time it took to make the equivalent (the C++
one was actually a bit worse, there were some things that were
implemented in wxpython that just didn't want to work in wxwidgets).
I'm not saying that coding in python is going to let you develop things
4 times faster, but there are some obvious advantages that I think
greatly increase development rate. Just making the framework for the
C++ gui was very time consuming. Added to this is that python doesn't
require linking and specifying libraries and all the other things that
tend to go wrong on the first attempt at compiling something. You also
don't have to specify void, int, char etc for functions, and of course,
there's no pointers. :D Best thing you can do is probably just to
download python and tinker with it, maybe try making some python
equivalents to whatever you've made in other languages.

Cheers
-Jordan
 
G

Gabriel Genellina

At Tuesday 14/11/2006 21:56, Ed Jensen wrote:

Bullshit. Complete and utter bullshit.

That's the plain truth. Python 1.5.2 final release is of 13 April
1999 <http://www.python.org/download/releases/1.5/>
JDK 1.2.2 came Friday, July 9, 1999 <http://www.cafeaulait.org/1999july.html>

By the time, Oracle8 installer was a Java application, and required
*several* minutes just to load and start running. That's an example
of java "speed" at that time.

We used to call Java "Ya va!", which in spanish means something like
"Wait, I'm coming!" :)


--
Gabriel Genellina
Softlab SRL

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
 
G

Guest

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,037
Latest member
MozzGuardBugs

Latest Threads

Top