I am new to programming and after a month or so of googling, I have decided to learn Python. Is this a good time to learn the language or people will soon jump ship since JAVA is now open source? By open source software, I understand that the code developed freely and more people have access. Am I right?

Python is a language that I personally have had no real experiance with but I understand is very popular in the open source world. Python and C appear to be the current choice for majority of open source developers, therefor you should have no shortage of projects to work on or great open source libarys to use. Java does not support as many open source libarys as python and I dare say will not anytime in the near future.

It appears that python is a really good beginner language and also quite good for quickly creating code.

I also don't see people jumping ship to support Java. I feel community development will be quite strong with python and Java will have alot more commertial development ( organizations that wish to create open source projects. )

it's never too late to learn python :)
awesome language, you'll pick it up quick and it beats VB (in my opinion)

A lot of programmers use both Java and Python. Python has the advantage of a much more rapid learning and program development phase. So I would learn Python first. Once you learn Python you can access Java libaries easily with Jython, also open source.

Python is one of the best languages I have ever used, after trying C, C++, Java, Ruby, and Perl. It's good for full-applications as well as small scripts.

If I would have to write an office suite to compete with Microsoft's Office, I would use Java, as has been successfully done with "Open Office". For projects that are less gigantic, and I need to develop quickly, I would use Python.

If I would have to write an office suite to compete with Microsoft's Office, I would use Java, as has been successfully done with "Open Office". For projects that are less gigantic, and I need to develop quickly, I would use Python.

Using OpenOffice.org as an example, you're right. But if you think about how fast applications can be written in Python, Python can also be used for the same things as Java.

I find Python a lot *cleaner*. Meaning, the JDK is blatently THERE. And you can easily tell when an application is written in Java. In Python, you can hide what the language in (but why would you want to, good point).

Also, you only have to run one command to run a Python script/application. Whereas with Java, you need three hundred million tools. What is it, like javac, javah etc?

I'd use Java, if they had one thing. Like, java JavaApp.java instead of three thousand.

Like, currently, I'm writing an application in Python similar to FL Studio. I mean, yeah, C++, C, Java, etc. maybe more efficient (by far) for a media-creation application, but Python is what I know and have for a tool.

I mean, if you have a pen, write in pen. If you have a pencil, write in pencil. If you know Java, use Java. If you know Python, use Python.

Personally, I find the syntax, set up, and workspace and running environment of Python to be far superior to that of Java.

pythin is used extensively for the AI in stragey games, so will continue to be used in that industry for a long time

Compared to Java, Python has simplified a lot of the syntax. It will spoil you, and you may actually have fun.

The proof is in the pudding. Take a small project like creating a monthly calendar and try to do it with Java and then with Python.

Look at the syntax of Java and Python. Which one would you rather use?

In that case Java.

Only reason I have never tryed Python is because of the syntax. I feel that is far removed from everything else. Switching from C++ to C to Java to C# is simple, The syntax in the languages are very similar, But that may just be me.

python has defiantly spioled me!

i hate the look of other languages even tho i'd love to learn them.. whenever i try.. i end up going back to python just cause it's so much clearer and quicker to make things.

i just wish it was a bit easier to create standalone programs that don't need the interpreter running. (i've tried py2exe but i just can't get my head round it)

Okay Paul, in your case you use what you are familiar with.

Here is a little Python code, that I have asked people to write in C++, C, Java or C# ...

a = 111111111   # that's nine ones
print a * a     # 12345678987654321

If it's late in the day and counting off nine ones is difficult you can use a = int('1'*9)

The thing about Python that I find more appealing than C, C++, Java, etc. is how you really don't need that many modules to do heavy things. You also aren't required to declare classes and functions to write a simple program.

That scares me a little, How does one implement a rotating counter in python ?

class Program
	{
		public static void Main(string[] args)
		{
			ulong a = 111111111; // Thats 9 1's
			System.Console.WriteLine((a * a));
		}
	}

using C++ and .net

using namespace System;

int main(array<System::String ^> ^args)
{
	Int64 a = 111111111;
    Console::WriteLine( Int64(a * a) );
    return 0;
}
//Don't have a java compiler but would be somthing along the lines of 
long a = 111111111;
System.out.println( (a * a).toString());
Comments
thanks for the code samples

sorry and in C

#include <stdio.h>
int main(){
	long long a = 111111111;
	printf("%lld", a * a );
	return 0;
}

Thanks for the samples of C, C++, C# and Java they make Python code look alarmingly simple.

Paul, what C++ compiler are you using?
The open source g++ gives me lots of errors:

Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\AtestCON\NineOnes1\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\testCON\NineOnes1\Makefile.win" all
g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"

main.cpp:1: error: expected namespace-name before ';' token

main.cpp:1: error: `<type error>' is not a namespace
main.cpp:3: error: `array' was not declared in this scope
main.cpp:3: error: `System' has not been declared
main.cpp:3: error: `String' was not declared in this scope

main.cpp:3: error: expected primary-expression before '>' token
main.cpp:3: error: expected primary-expression before '^' token
main.cpp:3: error: `args' was not declared in this scope
main.cpp:4: error: expected `,' or `;' before '{' token

make.exe: *** [main.o] Error 1

Execution terminated

Do you really think that this C++ code:

using namespace System;

int main(array<System::String ^> ^args)
{
	Int64 a = 111111111;
    Console::WriteLine( Int64(a * a) );
    return 0;
}

is easier to understand than Python:

a = 111111111
print a * a

ZZ, I think Paul's C++ code will only work with one of the Microsoft NET compilers. It is not standard C++ code.

The C and C# code samples work fine, thanks Paul!

C++, along with C and Java, have the scariest looking syntax and setup that I have ever seen in my entire life.

I mean, I've heard people choose C++ over, say, Python, because "you can write an operating system in it!"

Are you honestly going to need all those low- level functions? I use Python, and I can call sound, graphics, write games and multimedia applications, create web browsers instantly, and create a good looking GTK+ or Tkinter GUI in a matter of hours.

As opposed to using huge amounts of curly braced functions to call one thing.

And, I mean, Python syntax is just cleaner.

print "Output"

vs

stdout<<"Output";

I mean, I think that's the command in C++. I haven't touched C++ in a few years. Plus, the Python code up there will run without anything else, whereas the C++ one needs to define a class and function before using it.

The C++ was written ontop of .NET :. you would have to use the Microsoft compiler. Since it has to be compiled to run ontop of a jitter.

The C one should compile fine with GCC and with any luck the C# should compile with mono as well as the microsoft C# compiler.

But yes, my C++ code there is not very GNU frendly :P

a more gnu frendly C++ implementation would be as follows

#include <iostream>
using namespace std;
int main(){
	long long a = 11111111;
	cout<< a * a;
	return 1;
}

Thanks for the updated C++ code. Did you know that the executable file it creates has a size of 473k?

I do dabble with Java every now and then and have found the Jcreator IDE very easy to work with. So here is the corresponding Jave code ...

class NineOnes1 {

  public static void main (String args[]) {
    long a = 111111111;  // that's nine ones
    
    System.out.println("--> " + a * a);  // --> 12345678987654321
  }
}

Actually Python will allow you to just use ...

print 11111111 * 11111111  # 123456787654321

You cannot do a thing like that with C++ or Java.

Actually Python will allow you to just use ...

print 11111111 * 11111111  # 123456787654321

You cannot do a thing like that with C++ or Java.

Well as long as you cast you can do

cout<< long long(11111111) * long long(11111111);

same goes for java, C and C#. But I will admit that is alittle more complicated.

Thanks Paul, forgot about the need to cast. Alas, this code gives me errors with standard C++ ...

#include <iostream>

using namespace std;

int main(){
    cout << long long(11111111) * long long(11111111);
	return 1;
}

Here is the error message:

NineOnes3.cpp: In function `int main()':
NineOnes3.cpp:6: error: expected primary-expression before "long"
NineOnes3.cpp:6: error: expected `;' before "long"
> Execution finished.

Similarly, Java goes into a tantrum of errors.

Wonder if

cout<< __int64 (11111111) * __int64 (11111111);

would work.

Anyhow, This brings me, not very neatly back to my initial statment, that I like the syntax in C++, C# and C better.

Well it does not bring me back at all, I guess I finally have the time to discuss it.

My first problem stems from the fact that I am a terrible speller and therefor the fact that a assignment can essentually act as a decleration really allows me to create bugs that are easy to create but hard to diagnose.

and my second is just the fact that the syntax seems so vairyed from other popular languages. It not that you don't use {} you just use it for somthing else and then we are defineing functions
def bla():
then to finish the define leaving a white line. ( I would much rather a brace '}' then a white line ( personal opinion, leaves me the option of formatting the code however I want )).

Combine perl and python and you get the scripting language I want.

1. perl lets you u se strict; you HAVE to define varibles before use.
2. perl has braces in all the right places.
3. python allows you to define what you want passed to your functions :D

Anyhow, those are some of the reasons the syntax in python pees me off.

C++, along with C and Java, have the scariest looking syntax and
And, I mean, Python syntax is just cleaner.

print "Output"

vs

stdout<<"Output";

but the difference is that in python print is a keyword while in C++ its a function ( overloaded operator to be percise, but a function ).

If you want to call a function in python you still have to use ().

In this day and age magority of people are not displaying there users information through the console, So why in the world would you want a keyword dedicated to just this ? This I cannot understand. This is not a case of python being easyer then C++ its a case of python having a print keyword.

As my previous post indicates I like putting spaces in the middle of my code to brake up code blocks, Since using {} insted of : and CRCR (" two carrage returns in a row ) allow me to do this, I am quite happy with braces.

Anyhow if out problem is that we don't have a keyword for print, Try the following in your next C++ project.

#define print cout<<

I have programmed plenty with C or C++ in my life, and I have seen forests of curly braces creating statement blocks that take your breath away! Each { has be matched somewhere, maybe 50 lines down, with a }. :)

Python simply forces you to bring some order into these statement blocks using proper indentation, that's all.

This question has already been answered. Start a new discussion instead.