Page 1 of 2

Is python a bad choice?

PostPosted: Mon Jun 27, 2011 5:20 pm
by ampakine
I decided to dive into learning a programming language (for programming applications not just web applications) so I chose python as a first language since you don't need to compile programs and Ubuntu comes with a built in interpreter. I've started learning the language but I really don't like the syntax. I'm used to PHP and javascript and I don't mind learning a language with alien (alien to someone thats used to PHP) syntax but python syntax bothers me for some reason. I don't like the way variables aren't explicitly declared and the way statements aren't closed with semicolons etc. One thing I do like though is the way indentation is used as a delimiter for functions/if statements etc. instead of { } brackets. That makes things a whole lot simpler and probably saves python programmers loads of time that would be wasted trying to find where you put in an extra { or left out a } bracket.

Anyhow would I be better learning C or java as a first language instead since both these languages have the kinda syntax I'm used to? Is linux a good OS to learn C/C++ on?

Re: Is python a bad choice?

PostPosted: Mon Jun 27, 2011 6:43 pm
by fashizzlepop
Python is a great choice especially as it will force you to think slightly differently.

If you are interested in something as simple as Python but with more PHP like syntax, look up Perl. ;)

Re: Is python a bad choice?

PostPosted: Mon Jun 27, 2011 10:30 pm
by mShred
I too would suggest Perl for your needs. Faz pretty much summed it up.
ampakine wrote:Anyhow would I be better learning C or java as a first language instead since both these languages have the kinda syntax I'm used to? Is linux a good OS to learn C/C++ on?

To answer your last question, you can learn languages on any OS. But most people tend to think Linux is easier. Most distros come with Python, Perl, C compilers and whatnot already installed. With Windows, you'll have to download them and blah blah. It just seems simpler with Linux.

Re: Is python a bad choice?

PostPosted: Mon Jun 27, 2011 10:37 pm
by fashizzlepop
Linux's terminal is so much easier when developing small stuff especially. All I use is nano to edit most files. On windows you need to use notepad or something nasty.

Perl on Windows still works alright using Strawberry Perl.

Re: Is python a bad choice?

PostPosted: Tue Jun 28, 2011 7:10 am
by ampakine
fashizzlepop wrote:Python is a great choice especially as it will force you to think slightly differently.

If you are interested in something as simple as Python but with more PHP like syntax, look up Perl. ;)

I've got the urge to start with C++ cuz I like the syntax but I think I'd better just stick to python because if its too complicated I'll abandon it since I have many things I wanna learn but limited time to learn them. Would you say learning to shell script would prepare me for learning how to program in python and other other languages? I've got the urge to learn that too because in the process I'll be learning how to use the command line better but I don't wanna side track too much from learning a programming language. If it'll teach me lots of things I'll need to learn anyway for programming then I'll start with shell scripting though.

-- Tue Jun 28, 2011 7:10 am --

fashizzlepop wrote:Python is a great choice especially as it will force you to think slightly differently.

If you are interested in something as simple as Python but with more PHP like syntax, look up Perl. ;)

I've got the urge to start with C++ cuz I like the syntax but I think I'd better just stick to python because if its too complicated I'll abandon it since I have many things I wanna learn but limited time to learn them. Would you say learning to shell script would prepare me for learning how to program in python and other other languages? I've got the urge to learn that too because in the process I'll be learning how to use the command line better but I don't wanna side track too much from learning a programming language. If it'll teach me lots of things I'll need to learn anyway for programming then I'll start with shell scripting though.

Re: Is python a bad choice?

PostPosted: Tue Jun 28, 2011 10:23 am
by jpmut
If you really like C++'s syntax but are intimidate by it's complexity then try Java. The syntax is nearly identical but Java is much simpler.

Would you say learning to shell script would prepare me for learning how to program in python and other other languages?

They're complementary. It doesn't really matter which you learn first. In fact, in my opinion, the hardest thing is learning the first language... Once you understand programming, learning other languages becomes easier. For instance, I've only learnt Java but I can now read most (unobfuscated) C++, Python, or php code, so when the time comes to learn these I don't think it'll be the same as when I started with Java.

Re: Is python a bad choice?

PostPosted: Tue Jun 28, 2011 6:38 pm
by fashizzlepop
I'd say learn BASH second because it's such an ugly language. Perl and PHP are really similar and Java and C++ are pretty close. You can dip a little in all of them and choose your favorite.

Re: Is python a bad choice?

PostPosted: Fri Jul 01, 2011 10:27 am
by ampakine
jpmut wrote:They're complementary. It doesn't really matter which you learn first. In fact, in my opinion, the hardest thing is learning the first language... Once you understand programming, learning other languages becomes easier. For instance, I've only learnt Java but I can now read most (unobfuscated) C++, Python, or php code, so when the time comes to learn these I don't think it'll be the same as when I started with Java.

I'm gonna go with either C or java. I had trouble with java runtime environment in the past so I'm gonna install it and if I can get it up and running easily enough I'm gonna start learning java, otherwise I'll stick to shell scripting then learn C in the future.


fashizzlepop wrote:I'd say learn BASH second because it's such an ugly language. Perl and PHP are really similar and Java and C++ are pretty close. You can dip a little in all of them and choose your favorite.

Yeah I agree, being used to PHP syntax, I feel sick just looking at BASH syntax. I started learning shell scripting anyway though cuz by doing so I'm forcing myself to learn the commands and get good with the terminal. It seems to be a convenient way to add little custom features to your linux installation. For example I used to always go to dictionary.com when I needed to look up a word but now I made an application launcher that calls a shell script like this:
Code: Select all
gnome-terminal --execute sh /home/ampakine/ss/dictionary.sh

heres the shell script:
Code: Select all
echo "Define:"
read dword
curl dict://dict.org/d:$dword

echo "Press any key to exit"
read stall

not much of a script, I could fit all that into a single line but I'm fairly proud of myself lol.

Re: Is python a bad choice?

PostPosted: Sat Jul 02, 2011 8:35 pm
by jpmut
To program in Java, you need Java Development Kit (JDK) not the Runtime Environment (JRE). Download the JDK and it comes with JRE as well. For someone who hadn't used the command line before, I was confused on how to get the "javac" command working, but it was as simple as adding it to the PATH variable in the System environment. Google "Changing PATH variable in {Insert your OS}" if the command isn't working.

Re: Is python a bad choice?

PostPosted: Mon Jul 04, 2011 10:52 am
by tgoe
Skip bash entirely and learn sh. Notice your script doesn't actually use bash.

https://wiki.ubuntu.com/DashAsBinSh