Does Python compete with Java?

K

kk

I read this mailing list fairly often, and I am always amazed at what
I learn (even not related to Python). I am relatively new to Python.
I make my living developing mostly in Java. Python was a "discovery"
I made a couple of years ago, and I love the language, but only get to
use it at home for hobbies.

With all the recent - ESR tells Sun to open Java, or be relegated into obscurity by
Python, Ruby, and Perl.
- Project mono (C# compiler) is touted to be the next great thing in
Linux, and will be the dominate language. (by it's creator, of
coarse).
- This past weekend, Sun signs deal with devil (oops... Microsoft).
Now Java "openness" seems to have taken a very large step backwards!

I'd like to know if you guys think Python really has a chance to
compete with Java, .NET, and any other commercially backed language.

The reason I ask is I think it is important to have a "popular"
well-supported Open Source language to compete with the big players.
PHP seems to have some momentum in popularity, but I much prefer
Python as a language. Python has much to offer over Java, VB, etc...
Maybe the best chance it has is to ride on the coat-tails of .NET
(Python.NET) and the JVM (Jython). Interested to hear your comments.
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

kk said:
I'd like to know if you guys think Python really has a chance to
compete with Java, .NET, and any other commercially backed language.

Python, by nature, does not compete: it is a product, and only
producers of a product can compete with producers of other products;
products never ever compete with one another (a product has no soul,
and no goal).

Whether the makers of Python compete with the makers of Java or
..NET is an interesting question, and one that is difficult to answer.
The makers of Python a free software developers, many of them
volunteers. The maker of Java is Sun Microsystems, the maker of
..NET is Microsoft. The Python makers have very different motivations,
and for some of them, competing with Sun may be a motivation - others
could not care less.

The same holds for the users: Some users of Python compete with
some users of Java, whereas others don't. This continues into education:
authors of Python books typically compete with authors of Java books,
except for authors of the Python tutorial, which likely don't compete
with anybody (except perhaps that authors of Python books have to
compete with the authors of the Python tutorial and other free
online documentation).

The mission of the Python Software Foundation is (among others), to
publicize, promote the adoption of, and facilitate the ongoing
development of Python-related technology and educational resources.
Whether or not that makes the PSF a competitor of Sun Microsystems,
I don't know.
The reason I ask is I think it is important to have a "popular"
well-supported Open Source language to compete with the big players.

Why is that important?
PHP seems to have some momentum in popularity, but I much prefer
Python as a language. Python has much to offer over Java, VB, etc...
Maybe the best chance it has is to ride on the coat-tails of .NET
(Python.NET) and the JVM (Jython).

If Python works for you, just go ahead and use it. Consider all
advantages and risks, and weigh for yourself.

Regards,
Martin
 
J

John Roth

kk said:
I read this mailing list fairly often, and I am always amazed at what
I learn (even not related to Python). I am relatively new to Python.
I make my living developing mostly in Java. Python was a "discovery"
I made a couple of years ago, and I love the language, but only get to
use it at home for hobbies.

With all the recent - ESR tells Sun to open Java, or be relegated into obscurity by
Python, Ruby, and Perl.
- Project mono (C# compiler) is touted to be the next great thing in
Linux, and will be the dominate language. (by it's creator, of
coarse).
- This past weekend, Sun signs deal with devil (oops... Microsoft).
Now Java "openness" seems to have taken a very large step backwards!

I'd like to know if you guys think Python really has a chance to
compete with Java, .NET, and any other commercially backed language.

That's an interesting question. I presume you mean for
market share in terms of the number of real projects, loc
and all that stuff.

At one time I would have said no, but recently some of the industry
gurus have been questioning whether the additional complexity of
static typing and other Java complexities is paying its weight as compared
to Python, especially when used in a TDD type development environment.

Another thing to consider is that while Sun has a lot wrapped
up in Java, Microsoft does not have the same attitude toward
C#. It may look like it, but their strategic direction would be
satisfied just as much by IronPython as by C# - both run on the
..NET platform, and as long as they take advantage of the native
libraries they will both do as well to lock the user into Windows.
And IronPython seems to be a pretty good performer; at least
as good as Python itself, and accordingly it beats Jython by quite
a margin.
The reason I ask is I think it is important to have a "popular"
well-supported Open Source language to compete with the big players.
PHP seems to have some momentum in popularity, but I much prefer
Python as a language. Python has much to offer over Java, VB, etc...
Maybe the best chance it has is to ride on the coat-tails of .NET
(Python.NET) and the JVM (Jython). Interested to hear your comments.

PHP has a considerable mindshare as "the language" to write
a certain class of web application. Beyond that, Perl is, I think,
the dominant scripting language, but it suffers from a perception
that it doesn't scale, and it isn't maintainable unless the development
team is very disciplined in adhering to a sane subset.

I think the next 10 years are going to see a huge shift in the
languages and tools we use regularly.

John Roth
 
R

Roy Smith

John Roth said:
recently some of the industry gurus have been questioning whether the
additional complexity of static typing and other Java complexities is
paying its weight as compared to Python, especially when used in a
TDD type development environment.

Yeah, tell me about it. I've been playing around with some JSP stuff
lately. Here's a method I wrote:

protected void doLogin (HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
String name = (String) request.getParameter ("name");
String password = (String) request.getParameter ("password");
Connection connection = getDbConnection (request);

try {
LoginModel model = new LoginModel (connection);
boolean loginIsValid = model.validate (name, password);

if (loginIsValid) {
makeMainPage (request);
forward (request, response, "/main.jsp");
} else {
forward (request, response, "/badLogin.jsp");
}
}
catch (SQLException exception) {
throw new ServletException (exception);
}
catch (IOException exception) {
throw new ServletException (exception);
}
}

It's just filled with extraneous crap that's only there to make the java
complier happy and has nothing to do with the logic of my application.
The type declarations and casts are just the beginning. The interface
I'm inheriting from requires that the only exception I throw be
ServletException, so I need to catch all the others are re-throw.
Here's what the same logic would look like in Python, as a mechanical
transliteration:

def doLogin (request, response):
name = request.getParameter ("name");
password = request.getParameter ("password");
connection = getDbConnection (request);

model = LoginModel (connection);
loginIsValid = model.validate (name, password);

if loginIsValid:
makeMainPage (request);
forward (request, response, "/main.jsp");
else:
forward (request, response, "/badLogin.jsp");

13 lines of code instead of the original 26! This 2:1 ratio seems to be
pretty typical in my experience. It's not that I'm cramming more
application logic onto each line in the Python version, it's that I'm
getting rid of the fluff that takes up lines without adding anything
useful.

The end result is that it's harder to write, and the effort that goes
into making the compiler happy is that much less effort that I can put
into making sure I really understand how my application should be
designed, and testing it. It's a seeing the forest for the trees kind
of issue.

I think it's also a lot easier to read and understand the Python
version. Pretty much every line maps directly to the application logic,
with very little overhead.

Found on the web (http://www-users.cs.york.ac.uk/~susan/joke/foot.htm)...
How to Shoot Yourself In the Foot
[....]
Java
You locate the Gun class, but discover that the Bullet class is abstract, so
you extend it and write the missing part of the implementation. Then you
implement the ShootAble interface for your foot, and recompile the Foot
class. The interface lets the bullet call the doDamage method on the Foot,
so the Foot can damage itself in the most effective way. Now you run the
program, and call the doShoot method on the instance of the Gun class. First
the Gun creates an instance of Bullet, which calls the doFire method on the
Gun. The Gun calls the hit(Bullet) method on the Foot, and the instance of
Bullet is passed to the Foot. But this causes an IllegalHitByBullet
exception to be thrown, and you die.

They don't have one for Python, but I expect it would be something like
this:

You create a Foot object and call its shoot() method. The bullet makes
a hole in your foot, but by that time you've gotten dragged into a huge
flamewar about the relative merits of spaces vs. tabs for indentation
and barely notice the pain.
 
P

Peter Hansen

Roy said:
They don't have one for Python, but I expect it would be something like
this:

You create a Foot object and call its shoot() method. The bullet makes
a hole in your foot, but by that time you've gotten dragged into a huge
flamewar about the relative merits of spaces vs. tabs for indentation
and barely notice the pain.

See Laura's excellent

http://groups.google.com/[email protected]

and also a whole thread from late 2001

http://groups.google.ca/[email protected]

-Peter
 
G

Greg Ewing

kk said:
I'd like to know if you guys think Python really has a chance to
compete with Java, .NET, and any other commercially backed language.

It depends on what you mean by "compete".

Python is never going to have the same combination of hype
and money behind it as those other languages you mention.

But is that a bad thing or a good thing?

I think it's a *good* thing. Python is succeeding very well
by just existing and actually being well designed and useful,
as opposed to having a large company's marketing machine trying
to tell everyone that it is.

It sells itself to those who are willing to look. It doesn't
need or want any hype.
 
E

Erik Oomen

Roy said:
They don't have one for Python, but I expect it would be something like
this:

You create a Foot object and call its shoot() method. The bullet makes
a hole in your foot, but by that time you've gotten dragged into a huge
flamewar about the relative merits of spaces vs. tabs for indentation
and barely notice the pain.

Found this one at news.admin.net-abuse.email

Python
You shoot yourself in the foot and everything goes so smoothly that you
go ahead to to shoot yourself in the other foot then your legs, then
your torso and then your head. Problem solved.
 
C

Chris Herborth

Roy Smith wrote:
[... JSP example ...]
13 lines of code instead of the original 26! This 2:1 ratio seems to be
pretty typical in my experience. It's not that I'm cramming more
application logic onto each line in the Python version, it's that I'm
getting rid of the fluff that takes up lines without adding anything
useful.

I've experienced the same thing with the XML applications I tend to write at
work; the Python version is much smaller than the Java version, much easier
to read, and it was much easier to write. And tends to run about as quickly.

Strangely enough, I've had the same results with C# and .NET XML apps;
smaller, with less extraneous text in the code. And very fast. If Mono
and/or GNU Portable.NET were further along, I'd port my XML apps to C# (I
need to run on OS X and, eventually, Linux as well as Windows)...
The end result is that it's harder to write, and the effort that goes
into making the compiler happy is that much less effort that I can put
into making sure I really understand how my application should be
designed, and testing it. It's a seeing the forest for the trees kind
of issue.

One of Python's most awesome features (IMHO at least) is that you can fire
up an interactive interpreter while you're writing your code, and try things
out as you go... using this technique, I've unit tested methods and
algorithms interactively and ended up with useful, non-trivial applications
that run and work properly the first time.

With compiled languages (Java, C#, C++), I find I'm writing a bit of code,
taking a break to compile it, figuring out how to unit test the method...
Python saves me a huge amount of time in the prototype and development cycles.
 
C

Chris Herborth

Harald said:
I think the most common solution is:


Python
you discover that Guido used his time machine to shoot you in the foot
years ago

My experience:

Post to comp.lang.python:

"I'm looking for a good scripting language, and Python's got some great
features, but that syntactically-relevant whitespace thing just seems wrong..."

Replies:

"Don't worry about it, in practice you'll see that you write code that way
anyway and it's very natural..."

Me:

"I don't know..."

[Wanders off for a few months. Returns.]

"Python rules! Best scripting language EVAR!"
 
J

Jacek Generowicz

Chris Herborth said:
One of Python's most awesome features (IMHO at least) is that you can
fire up an interactive interpreter while you're writing your code, and
try things out as you go... using this technique, I've unit tested
methods and algorithms interactively and ended up with useful,
non-trivial applications that run and work properly the first time.


With compiled languages (Java, C#, C++), I find I'm writing a bit of ^^^^^^^^^^^^^^^^^^^^^^^
code, taking a break to compile it, figuring out how to unit test the
method... Python saves me a huge amount of time in the prototype and
development cycles.

Please note that this has nothing to do with compilation per-se. There
are languages with to-native-binary compilers which give you all the
instant turnaround flexibility that Python does.

Indeed, there are even some development environments for the languages
you mention which try to provide a similar experience.
 
R

Roy Smith

Jacek Generowicz said:
Please note that this has nothing to do with compilation per-se. There
are languages with to-native-binary compilers which give you all the
instant turnaround flexibility that Python does.

Even more interesting is the fact that Java and Python both have very
similar architectures (similar enough, in fact, that things like Jython
are possible). Both compile your source code text into an intermediate
"byte code" form, and both then run this intermediate form on a virtual
machine.

The difference is that Java exposes the compilation step to the user
while Python hides it. If you really wanted to, you could hack up a
"Python compiler" which takes .py files, imports them to force
generation of the corresponding .pyc files, and then exits without
executing anything. You could then execute the .pyc files in a distinct
"execute phase". Not sure why you would want to do that, though :)
 
P

Peter Hansen

Roy said:
The difference is that Java exposes the compilation step to the user
while Python hides it. If you really wanted to, you could hack up a
"Python compiler" which takes .py files, imports them to force
generation of the corresponding .pyc files, and then exits without
executing anything. You could then execute the .pyc files in a distinct
"execute phase". Not sure why you would want to do that, though :)

python -c "import py_compile as p; p.compile('mymodule.py')"
 
A

A. Lloyd Flanagan

Greg Ewing said:
I think it's a *good* thing. Python is succeeding very well
by just existing and actually being well designed and useful,
as opposed to having a large company's marketing machine trying
to tell everyone that it is.

Very true. In addition, I think python will gain a lot of
"mind-share" as more and more popular applications are written in
python.
 
D

Dave Benjamin

Very true. In addition, I think python will gain a lot of
"mind-share" as more and more popular applications are written in
python.

Over the long term, I think Python's biggest key to success will be that we
will still be able to read the programs that we are writing now.
 
A

A. Lloyd Flanagan

Dave Benjamin said:
Over the long term, I think Python's biggest key to success will be that we
will still be able to read the programs that we are writing now.

No argument here :)
 
J

Jakub Fast

Over the long term, I think Python's biggest key to success will be that we
No argument here :)

Hi,

I'm totally fresh to python, and i'm enjoying the language, and the
readability a lot, but i just bumped into something that -- from my
purely subjective perspective -- surprised me with pretty awful,
not-very-readable syntax: operator overloads and static methods. is this
an issue that is argued over? i just find these particular bits to be
10x more intuitive the way they are implemented in c++...

would having the possibility of using

def static mymethod():

instead of the standard = staticmethod(...) do anything bad to python as
it is? Same question goes for something along the lines of
__operator__['='] (self, etc).

On quite another note, is it possible to define your own operators in
python? you could argue that this might actually make the code _less_
transparent, but then, at least for some cases, my experience shows that
a few cleverly defined operators work magic in terms of bumping up the
ease-of-use of a library. what i'm thiniking about, exactly, are the
"--->"'s, "==>"'s, or "~~>"'s you'll see people using in prolog for
instance. Also, can "and", "or", "not" etc. be overloaded?

I've been pondering using python+NLTK to teach a computational semantics
class this summer (precisely because i think the basics of python would
be easy for the students to learn quickly, and, class aside, that
learning them actually might turn out useful for whatever they want to
do in the future -- more useful than, say, prolog) and nothing can beat
the intuitive appeal of

S ==> (NP and VP) or VP

over CFGProduction(S, NP, VP), CFGProduction(S, VP) for specifying your
simple cfg, dcg or ebnf rules if you're completely new to programming
and have just been given a programming assignment :)


Any comments, any answers?

Thanks in advance.

Kuba Fast
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

Jakub said:
> would having the possibility of using

def static mymethod():

instead of the standard = staticmethod(...) do anything bad to python as
it is?

In Python, people actually use static methods much less frequently than
in, say, Java - there is absolutely no problem with having global
functions (rather than class-static methods) most of the time. This is
partially due to the fact that static methods did not exist for a long
time.

However, this issue is being considered. Most likely, the new syntax
will read

[staticmethod]
def mymethod():
...

The debate is only about where the [staticmethod] should go. Solutions
introducing new keywords are not acceptable. See PEP 318 for details
> Same question goes for something along the lines of
__operator__['='] (self, etc).

Overloading assignment will never happen, for two reasons:
- assignment is not an operator, but a statement
- assignment does not modify an object, atleast not in the
form

variable = value

(in the form object.variable=value, it does modify object,
and you can overload the assignment by implementing __setattr__
or using by using properties)
On quite another note, is it possible to define your own operators in
python?

No, it isn't. People would not like it because it looks like line noise.
nothing can beat
the intuitive appeal of

S ==> (NP and VP) or VP

over CFGProduction(S, NP, VP), CFGProduction(S, VP) for specifying your
simple cfg, dcg or ebnf rules if you're completely new to programming
and have just been given a programming assignment :)

With several years of computing experience, I cannot understand neither
notation without some background. They look like a logical implication
to me, but I'm uncertain whether you are aiming at an assertion to be
tested, or merely at the grammatical structure.

If it is the structure, you should be able to write this as

S.implies(NP.and_(VP).or_(VP))

(assuming I have the grouping of your logical notation right - I have
troubles guessing whether ==> or `or´ should have higher precedence)

Regards,
Martin
 
J

Jakub Fast

No, it isn't. People would not like it because it looks like line noise.

I guess that qualifies as a definite answer. Shame, though, in my
stubborn and incorrigible ways i still kind of think a well-constructed
operator saves the day, especially when exposing your language in a
"custom" environment, such as embedded scripting or a neatly defined
collection of 'special' tasks. Of course you can always resort to
getting the user to provide text files that you parse yourself according
to some custom grammar (which is what i'll probably end up doing), but
that has disadvantages in regards to a nice side effect of getting
people to pick up some python on the way and actually feel like they're
really programming.

and yes, i do think this is enough of a reason to look at other
languages that do permit op overloading for you embedded scripting in
some cases (like when you don't want to confuse the average user too
much and make typical tasks as easy as possible while retaining the
versatility of a full-fledged language).

of course custom operators (if they permit alphanumeric shapes for
instance...) can make one major mess of your code, but then, isn't the
zen of python more along the way of: "the master hits the student
repeatedly with a stick and the student experiences enlightenment"
rather than "the master takes the toys away from the student". Is just
the inclusion of a feature like this into the language considered evil,
especially taking into account that it does not intervene with whatever
else there is in the language?
>
If it is the structure, you should be able to write this as

S.implies(NP.and_(VP).or_(VP))

This is completely fine and actually quite cool if you've had your OO
practice, but the point is that the parts you actually felt missing and
which made my formulation unreadable to you are absolutely obvious for
anyone who has had anything to do with linguistics -- which definitely
would be the case with whomever i'd show the module to :) -- and the
sample form i give would require 0.5 degrees of learning effort, as
opposed to 10.5 degrees or way more if you're completely new to programming.


Is there really no chance this goes into python on an "if you really
have to do this, be warned, but here are the tools" basis?

Anyway, hope i'm not boring you to death and thank you for your answers

Kuba
 

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,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top