Python a good first language... is it PRACTICAL?

Hey,

I once did a bit of C++, but heard that Python makes an ideal first language because it is easy, well documented and will introduce me to programming concepts.

  1. However, is an interpreted language such as Python PRACTICAL? I don’t see many programs being written with it (maybe because it can’t be made closed-source) and someone in school told me it’s so simple that there’s no real point in learning it as other languages are way more complex (he reccomended Perl). Is this true?

  2. How easy is it to integrate into web pages and is it ‘useful’ on websites? In the way that PHP is, for example? Thanks.

  1. Python is a very practical language. You can make windows and linux applications, games and do web stuff. Pretty much anything you want. Big parts of Civ 4 are written in python. A lot of websites use python web frameworks and even Youtube uses python. There is also a ton of general purpose scripts out there too. So, python is definitely used out there.

  2. Python is not a simple language. It has a lot of advanced language features. Also, anyone who tells you to use perl is someone you don’t want to listen too. I mean, if you already know perl and are comfortable with it, fine. But, otherwise, it is a painful language because of its cryptic syntax and you shouldn’t bother with it if you a beginner.

  3. Python is a little harder to integrate than perl and php, but easier than ruby. Mod python is a stable and fast solution, much the same way mod php is. However, you have to write a little more code unlike php which has a lot of built in web functions because that is it’s primary goal, while python is a general purpose language, unless you use the tons of python web frameworks out there.

  4. Python is faster than perl, ruby and php. Of course, that is relative, but it can definitely compete with other dynamic languages.

  5. I actually would say that python, like ruby, seem like they would make a good beginner language because of there clean syntax and simple things look really nice. However, things can get messy quickly and it might be very hard for a novice programmer to understand what is going on with some of the language features. So, I would recommend a simpler language like PHP and after mastering that you can try a more advanced language like python or even ruby.

Perl’s syntax isn’t, by definition, cryptic. If you want to write terse code that isn’t necessarily simple to understand at first glance, you certainly can do that. If you want to write clearly commented code, verbose code that’s simple to follow, you can do that too. How cryptic any Perl code is is entirely up to the person writing it.

As for the speed, I’ve seen benchmarks that go both ways. Much depends on the implementation of the algorithm being used.

So as a first server-side language… Python or PHP? PHP probably has greater compatibility with servers, but I’m not sure of this…

Personally I want to learn php, I’ve looked into python; but decided if I was going to learn another language it would be php, much more server friendly than perl scripts, at least from what I’ve found.

I learned perl/cgi from doing searches in search engines and asking questions on forums back in 2002 without any programming language or even computer background, I could hardly type 20 words per minute at the time. . . . I guess whatever format I learned wasn’t too difficult, and it has a lot of value for website applications.

However, I think php would be the better way to go, personally.

If web development is your primary interest, then PHP can be easier to pick up.

Else, Python can work really well as the first programming language, mainly because of it’s clean syntax.

Php is a good language to pick up and then you can gradually move on to other programming languages.

>>I once did a bit of C++, but heard that Python makes an ideal first language because it is easy, well documented and will introduce me to programming concepts.<<

Seems to me that iff you did C++, then you hardly need an introduction to programming concepts.

Also, your experience in other languages may make Python a little more difficult. Python does thing differently than many other languages. You may some Python conventions truely odd. I know I did.

>>However, is an interpreted language such as Python PRACTICAL?

Very much so, for many purposes. However, Python is often used like MS-Excel in the sense that it is as used as a tool, rather than a primary skill. A lot of people earn a living as “Java Programmers” or “PHP Programmers.” There are not very many pure “Python Programmers.” Python is used extensively by scientists, engineers, data analysts, digital artists, security experts, systems administrators, database administrators, and many other professions. Again, those people use python as tool, rather than their primary skill. Here is a thread, started by me, on the subject.

http://groups.google.com/group/comp.lang.python/browse_thread/thread/64b947bf0d77a9da/45a0d58bc1dd3372?lnk=st&q=walterbyrd&rnum=2#45a0d58bc1dd3372

>> 2. How easy is it to integrate into web pages and is it ‘useful’ on websites? <<

I agree with other posters, Python is more difficult to integrate into web-sites than PHP. But, not all that difficult.

BTW: if you are interested in using Python to develop web-sites, you may want to look at django.

The one saving grace for Python, for me is that you can compile it; If it were not for this one thing, I would have second thoughts in regards to Python.

If you are developing for the web, then use PHP is my advice - forget about RoR as there are still a number of issues with the framework - otherwise if your doing software development, consider using Python.

If you take the time out to research Python, not only as a programming language, but what it’s capable of and how other people are using it, you’ll see that there are considerable advantages, over Java for example?

Although Java is beautiful it’s seriously complex, more so than Python.

This is rather unbelievable to read. Python, along with Ruby, are two of the up and comers. It’s hardly a “first language for beginners”. Why Ruby has its own board while Python is lumped in with Perl and others is beyond me. In fact, Ruby is more closely related to Perl than Python ever was.

If you are interested in Python. Good for you. A great one for your toolkit.

here here!

I don’t know why people seem slag off python at sitepoint!? It’s a very powerful language that can be put to use in a range applications (console, desktop, web) and needs to be given the respect it deserves!

as said above it is a good language to know as it is very up and coming, i’m sure you’ve heard this before but alot of huge companies (inc google and NASA) use it in various applications.

There are a lot of php users on SitePoint; one thing I’ve discovered about php in general from people I know personally is it becomes a bit of a mantra-- there is no language but php. Granted, it’s incredibly powerful for what it is but still…

At any case, I read this forum and decided to try it out for myself. I bought a book from Amazon.com titled “Python Programming for the Absolute Beginner, Second Edition (For the Absolute Beginner)” and I’m already writing simple programs. The language is extremely easy to read and seems very common sense. I’d like to comment, though, that it took the hands-on approach book to really get me into programming; certain concepts like OOP are difficult to understand until you start applying it yourself.

Python syntax is squeeky clean. As close to pseudo code as you can get. Whenever I have a need for a small tool, when I need to brew up an app to make a certain aspect of my job easier, I’ll make it in python. Python makes prototyping working programs easy. Most of the python programs I write will work perfectly upon first time execution. Most programmers know that this is an extremely rare and beautiful occurrence that only happens once in a blue moon :slight_smile:

The language itself is designed very well too. The way it handles modules, extensions, its OO features, etc.

It is most definitely not a “toy” language like some seem to be saying – it is extremely powerful. Entire apps have been built in python (like others have been saying, Google and NASA are huge supporters). Python works very well as a glue language. Say you have an app that contains some code that is performance critical. Just write the performance critical parts in C/C++, create a library and expose it to python through the extension interface.

In terms of web development, if you are new to it, go with PHP. Python + Django still have a way to go, and Ruby on Rails still has a few of its problems. BUT, don’t let anyone tell you that python is “too” simple … the syntax is simple, but you can write some incredibly complex software in it, VERY QUICKLY.

So a question…as an advanced ColdFusion programmer, but an absolute Python novice, what would be the best way to start using Python?

Do you have to compile it? Do you need extra software to run the apps? Are you saying that you can write a real desktop app with Python? I’d like more information if you please. Thanks in advance.

yes you can do with python, what you can do with most other languages (ie desktop apps, conole based apps and web based apps).

python is an interpreted language, meaning instead of compiling it to say binary as a c/c++ compiler would do, the python interpretor reads in the code you have written and then executes it.

a good way to start learning python is write simple console based applications starting with the traditional ‘hello world’ one, then getting more and more complex, such a simple calculators, anything really to let you get to grips with how the language does loops, ifs statements etc, then i would start writing object orientated programs after that, getting to drips with how it works again. then move on to more complex stuff such reading and writing to files etc when you think you’ve got an idea of how python works, then you can move on to the really fancy stuff like GUI’s and web apps. but i really wouldn’t move on to these until you fully understand how it works, you’ll just confuse yourself.

if writing a web app in python i would suggest not using CGI. use a modern web framework such as Django(my personal recommendation) or Turbogears. if you want to write a Desktop app, there are many GUI frameworks available (can’t think of any off hand). also there is a free book called ‘how to think like a computer scientist, programming in python’, though it is quite complex and i would advise buying a python book, might be easier to follow.

anyway good luck, as you’ve probably guessed i’m quite a big fan of python!

Basically, the question is what you consider to be practical. If you are planning to do something that can be done by modifying existing systems, PHP could be better solution. Just because there is much more free code available.

However, if you are writing a web application from scratch, using python makes a lot of sense in the long run. Code is very easy to maintain and the process of programming itself is enjoyable. The problem with python for the web is that there is no standard way of doing things. There are a lot of different frameworks to choose from for every possible taste. And probably you will need to spend some time evaluating them until you settle on something.

To integrate into web pages you can use some stand-alone templating package like Cheetah. High level frameworks such as mentioned here [URL=“http://www.djangoproject.com/”]Django and [URL=“http://www.turbogears.com/”]Turbogears have some default templating system included.

As to examples of python applications, original bittorrent was written in python (and some of modern desktop clients), trac project management, [URL=“http://www.gnu.org/software/mailman/”]mailman mailing list manager and many others.

I have a link for you, one which I have been reading though as time permits. It stuck me as a great primer and tutorial for python. Here’s that link