ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I just have a question. I am beginning to learn Python, but so far I've not been impressed with the language structure. It resembles BASIC too much and it's syntax is quite awkward for me coming from a C, C++ background. Also I am uncomfortable with the loose typing (no variable declarations) and so on.
But I have heard many good things about Python. My question to experienced Python programmers is : Is it worth learning Python?
I am familiar with PHP and find it much more comfortable although I haven't really had too much to do using it so far.
Location: Student of University of Mumbai, Maharastra State, India
Distribution: Redhat Linux 9.0, Knoppix LIVE CD, Ubuntu Live CD, Kubuntu Live CD
I dont really know much about Python and haven't learnt it. But becoz Python is a Object Oriented Programming I feel it is an important language to learn and develop things much better.
Well, I also have one question!
Is Python Cross platform oriented like Java...or how is it functioning actually...(again to all the programmers who are experienced!)
Every language is worth learning. Pyhton can help you create very good apps, cross platform and it's easier than C/C++/Java. If you have a look at sourceforge you'll see that many projects are in python. Give it a try!
Try a programme to organise you photographs. This will test almost every aspect of your capabilities apart from mutlimedia (unless add sound).
Second thought turn your photographs into a movie and really test your skills.
Python is definitely worth learning. It is becoming more and more prevelant as the scripting language of choice in certain areas (e.g. the Ubuntu distro makes use of Python considerably to provide various add-ons like their menu editor project).
The fact that variable types are not decalred is often met with reservation by folks who come from a background of languages that require lots of type declarations. For example, I have a C++ background. I was a little concerned that not having the types of variables explicitly declared might lead to some headaches. But I found that in practice, not declaring the types just saved me a lot of extra typing on the keyboard. A parallel I like to draw is that in modern practice, a lot of emphasis in C++ is being placed on the practice of using templates and meta-programming techniques. The idea is to get the compiler to infer and generate types for you. It turns out that the actual type of an object isn't so important as th fact that it conforms to a set of behaviors that operate on it. It turns out that in Python, this is exactly what you get. Here is a quick example:
What is interesting in both these cases (C++ and Python), is that the types of the operands are not particularly significant. What is important is that you must be able to add the first and second parameters together and return the result. In C++, the compiler will catch this problem at runtime if the types don't support the addition operator (+). In Python, the error is caught at runtime with a nice, built-in stack trace. The fact that I can focus on coding the problem at hand rather than focusing on the syntax of what I want to describe more than makes up for the early constraint checking, in my opinion.
Also, Python is considered a very straightforward language with very few surprising idioms. This makes it easy for someone who does not have a lot of hard-core programming experience to work with the language.
> Python looks good, but I don't see what it offers beyond Java to be honest.
and I'm inclined to say that I don't see what it offers beyond Java either.
In general, scripting languages are for gluing together command line apps and for dealing with text. bash does this pretty well, Perl does it too, and Python can do it well enough also. When you want a general purpose programming language though, I'll head straight for Java. It's not flashy and it's a bit verbose, but for large apps, I think it's the way to go. It seems to me that Pythonistas try to sell Python as a general purpose programming language, but I don't buy it. My hunch is that lack of static type checking at compile time just sets you up for hunting hard-to-find bugs later on at runtime.
BTW, Python is in fact a strongly typed language. Types matter -- it's just that they matter at *runtime*, rather than when you actually compile the code (yes, Python is compiled, just like Java or Perl -- it happens quickly first thing when you run the script). Python is strongly typed, but also *dynamically* figures out the types of objects when required.
Not sure what you mean by "...true 'object' oriented..." nature. I have observed the object-oriented model is somewhat vague and open to various interpretations. There are certainly commonalities throughout various languages, but it is hard to say "here is archetypical example of object-orientedness".
Python provides multiple avenues of approaching programming. OOP is one valid approach, but I have seen procedural and functional approaches used as well.
Originally posted by carl.waldbieser
[B]Python is definitely worth learning. It is becoming more and more prevelant as the scripting language of choice in certain areas (e.g. the Ubuntu distro makes use of Python considerably to provide various add-ons like their menu editor project).
Python's nice, but if you don't need the Python libraries I prefer Ruby.
OTOH, Pyrex is a nice extension to python, that lets you easily blend Python, where you want flexibility, with C where you want performance. (Note that there is, as one would expect, overhead in the connection, but if you properly divide things that can be minimized.)
Python doesn't have much in common with Basic...actually, I feel that it has less in common with it than C does. It's mode of structuring code through indentation can take getting used to, but really isn't THAT bad once you get used to it.
Relatively speaking, Python is a slow language. It's certainly no faster than Java. OTOH, writing the code is a lot faster once you get used to it. (There's LOTS of libraries to make some things easy, and slow things fast.)
Worth learning? Depends on your purpose. Languages I currently find worthy are Ruby, Python, D (Digital Mars D == dmd). On the fringe are Eiffel, Ada and Smalltalk. I don't consider either C or C++ as worthwhile because of the mess they cause with their insistance on pointers everywhere. A compiler should HIDE that garbage from you, for two reasons:
1) It's quite easy to make mistakes
2) It makes garbage collection difficult to impossible.
(Note that all of my top tier of languages have garbage collection built in. If you're into hard real-time programming, then you have considerations that make these languages a poor choice.)
It's not that I can't program in C (and a doggerel of C++), it's that I despise doing so. My disgust with pointers didn't come quickly, but only through bitter experience...and trying to figure out what someone's code was doing when he cast a int to a pointer...without decent documentation, and with obscurely named variables.
(All that said, I do prefer C over Basic, but it's a close try...and I prefer Java over either, but even Java didn't make it into the top two levels of what I consider a good programming language. [P.S.: My comment about Eiffel is a couple of years old. The language appears to have been going through a bunch of redesigns recently, and I don't know what the current version is like. The rumors haven't been encouraging, so perhaps it should be moved down below the second tier...but it DOES have garbage collection.])