new language - python

mrhnau

Senior Master
Joined
Aug 5, 2005
Messages
2,269
Reaction score
34
Location
NC
well, I periodically have lunch w/ a tech genius friend of mine. we often talk computers/technology. I've been working on a new project over the past few months, and he suggested changing it from C++ to Python. The project was up to about 20 hours work, 500 lines and three seperate files. I read a short bit about Python, started playing with it. Within about 2 hours of reading and about two hours of programming, I had already caught up with my C++ project. Took about 25 lines :) needless to say, I was majorly impressed! A very efficient and flexible language in comparison to the other languages I've worked with (Pascal, C++/C, HTML, Perl, AWK/SED and smidgens of others). I think I'm in love :ultracool

My tech friend mentioned he wrote a simple web server in a period of a few hours. Anyone else use the language? Whats your opinion?
 
oh for a second I thought you were talking about Parseltoungue... ( :wink1 )
LOL I'd not be posting this in the Computer Talk section if that were true ;)
 
I've worked a little with Python but I do more with scripting languages such as Tcl/Expect. It does seem powerful :)
 
I've used python before....I am not really a fan of it, it has annoyed me more than anything else, however I do know it is a powerful language...
 
Our CS dept. is thinking of changing to Python as the first language taught...I am not so excited about it.
 
Ping, just out of curiosity, what is it that has fostered your opinion of 'Python'?

I've never used it myself so I can't comment but I've heard only ''good things' from people who have. It'd be nice to hear the 'flip side'.
 
Our CS dept. is thinking of changing to Python as the first language taught...I am not so excited about it.

What are they currently teaching? C++/Java? What makes you think it would not be a great primary language? The first language I learned was Pascal. I have not touched that in more than 10 years. Picked up C++ as the default first language in college.

I think its a great secondary language. C++ is simply lacking in string tools. Great for OO, but I'm finding out Python is pretty nifty in that category. I love the lack of firm typecasting. I know its not critical, but I hate the often cryptic error messages in C++. Even running a debugger its hard as heck tracking down those annoying seg faults...
 
I love Python and I've used or scripting websites and for desktop application development (BioInformatics and Satellite Damage analysis). Professional work. Even though I don't develop it professionally currently I still keep it around on my computers (both work and home) for certain problem solving and one-off types of situations.

I would definitely use it as a first teaching/learning language because it has a very clean syntax so you can study 'programming concepts' with getting wrapped in in language rules.

Actually, I tend to use three languages by choice. Smalltalk for the heavy lifting, Python for quick and dirty that requires more than shell scripting can handle but not as 'big as Smalltalk, and C for when perfoamance is the overriding criteria. I've used C++, Java, TCL, Perl Ada, and Delphi for professional work before but they are usually cases I've used them where outside factors dictated the language choice.

I love it
 
What are they currently teaching? C++/Java?

Java, only. The problem that needs to be solved is that they still aren't getting structured programming skills through (that is, for loops). The new course would be 70% Python followed by 30% C (or perhaps C++).

What makes you think it would not be a great primary language?

I don't know Python. But we're an engineering, math., and science college, and my understanding is that it's an interpreted language not known for its speed. While I know of books about doing scientific work in Python and packages like NumPy and SciPy for it, it can't match the libraries (like IMSL, NAG, and vendor-supplied BLAS) available for significant numerical work in C(++) or Fortran. I'd much rather we use a mainstream scientific computing language that people will actually use for serious work, not a newer language that someone thinks people should be using for it, but that currently lacks the same scientific software support.
 
I don't know Python. But we're an engineering, math., and science college, and my understanding is that it's an interpreted language not known for its speed. ...I'd much rather we use a mainstream scientific computing language that people will actually use for serious work, not a newer language that someone thinks people should be using for it, but that currently lacks the same scientific software support.

You have to walk before you run. You have to understand problem solving in general before you get into specialized tools to solve specific problems. And above all you don't want to build your foundation on a toolset that could be made obsolete over time. Build a conceptual framework first, then move on to particular tools. If the tools change over time, you always have that conceptual foundation to revert back to in order to go in a different specific direction.
 
True...but the conceptual foundation could just as easily be built in C or Fortran, which clearly will be here for the near future, no? Pascal, mentioned earlier, was intended for such a 'conceptual' purpose, and I think that that's been deemed a failure. Tools will definitely change, but there are ones being used now that seem like good choices to me.

Is an interpreted language really the best choice, given that many of these students will only take one dedicated CS course (then use computing in their disciplines)? They are also exposed to Maple in math. courses, and it is interpreted. Many of them will use Matlab (which drives the need for structured prog. experience, really).
 
True...but the conceptual foundation could just as easily be built in C or Fortran, which clearly will be here for the near future, no?

Um, no : ) This goes back to my first comment. Python is very simple synactically; which allows you to focus on problem solving and learning programming concepts, rather than language specific peculiarities. Fpr example, as soon as you start teaching about the concept of a 'function' you run real quickly into the problem of teaching pass-by-value versus pass-by-pointer semantics, which is absolutley crucial to get a good understanding of for even simple problem solving. This is a language feature of C and C++ that is abstracted away from the developers attention. *Yes*, the issue of badd by value vs pass by pointer, and pointer arithemtic for data structures, and stack allocations vs heap allocation are crucial concepts for the engineering of critically high-performace areas of code. *No* they are not concepts that most programmers should care about on a day to day basis and not something the beginner should have to deal with.

Pascal, mentioned earlier, was intended for such a 'conceptual' purpose, and I think that that's been deemed a failure

A failure for teaching or a commercial failure? My first serious professional language was Ada and you could argue it's been a commercial failure and I haven't used it in well over a decade, but the concepts I learned from it stay with me, even though it's architecture is almost diametrically opposed to my two favorite tools, Smalltalk and Python.

Actually I think if it's just an intro CS class before moveing on to the specialized tools in specific courses, then Python's a great choice, for the reason that it's simplicity allows you not to have to waste time with concepts that will not be neccssary at later times
 
Ping, just out of curiosity, what is it that has fostered your opinion of 'Python'?

I've never used it myself so I can't comment but I've heard only ''good things' from people who have. It'd be nice to hear the 'flip side'.


Probably the fact that irs use was forced upon me by someone who though the sun rose and set on Python and wouldn't accept any other opinion....
 
Probably the fact that irs use was forced upon me by someone who though the sun rose and set on Python and wouldn't accept any other opinion....
I think every language has its merits. I doubt you can be a really proficient programmer these days using just one language.
 
True...but the conceptual foundation could just as easily be built in C or Fortran, which clearly will be here for the near future, no?

Um, no : ) This goes back to my first comment. Python is very simple synactically; which allows you to focus on problem solving and learning programming concepts, rather than language specific peculiarities.
[...]
Actually I think if it's just an intro CS class before moveing on to the specialized tools in specific courses, then Python's a great choice, for the reason that it's simplicity allows you not to have to waste time with concepts that will not be neccssary at later times

I see this point. Yet, for us, it's the sole programming course taken by a variety fo science and engineering majors, and so I'd rather it to 'double duty' by teaching the concepts in a widely used language. If we teach them Python in CS I then they need to be taught something else later. I'm not sure we have the time in the curriculum to teach them a less used language that's good for the ideas, then a language in which they can do serious work using decades-old specialized libraries.

I remember friends taking Ada, Pascal, and APL. I think most people are better off nowadays mastering the ideas in something like C--we have been using Java recently--then being able to use it. It kills two birds with one stone--theory, and practice.

Put another way, isn't Python generally implemented in C anyway?
 
Back in 2000 and 2001, I dabbled in Python for a while. It is pretty cool. But I make my living with Microsoft tools, so I have not really had alot of time to devote to it. It seemed easy to use.

At one point we used it as middleware between our MS SQL server and our web application (back in 2001) and at that time we had some issues with how flexible it was in dealing with MS SQL Server. It had some problems with return parameters from stored procedures. I believe I had to write the procedures so they returned the values as a recordset, then it was able to pick it up. At that time it really lacked a good interface to the SQL server.

On the upside, it processed large strings very fast!
 
Back in 2000 and 2001, I dabbled in Python for a while. It is pretty cool. But I make my living with Microsoft tools, so I have not really had alot of time to devote to it. It seemed easy to use.

At one point we used it as middleware between our MS SQL server and our web application (back in 2001) and at that time we had some issues with how flexible it was in dealing with MS SQL Server. It had some problems with return parameters from stored procedures. I believe I had to write the procedures so they returned the values as a recordset, then it was able to pick it up. At that time it really lacked a good interface to the SQL server.

On the upside, it processed large strings very fast!
Out of curiousity, do you think the problems are MS SQL specific or generally is python weak on DB's? One of my projects deals with DB's, so I'm curious to your opinion. The DB type interactions are likely to be simple, and perl has been great so far in that aspect. I've just read a bit about python, specifically by the author, so of course it will be flattering :)

Currently, the project I'm working on is string processing intensive, so python has been a pleasure to work with. I've done a good amount of work with Perl and sed, but its nice to have a bit more flexibility...
arnisador said:
I see this point. Yet, for us, it's the sole programming course taken by a variety fo science and engineering majors, and so I'd rather it to 'double duty' by teaching the concepts in a widely used language. If we teach them Python in CS I then they need to be taught something else later. I'm not sure we have the time in the curriculum to teach them a less used language that's good for the ideas, then a language in which they can do serious work using decades-old specialized libraries.
I'll agree on this point. I think C(++) makes a great entry point. I think however, some of the weak points in the language are covered very well in python/perl. Given the ultimatum of time for only -one- language, I'd probably have to chose C. That being said, in alot of my coursework a programming language was taught as a part of the class. I learned perl as part of a bioinformatics class for instance. Once you learn one or two languages, it's not too hard to move on to new ones.

arnisador said:
I don't know Python. But we're an engineering, math., and science college, and my understanding is that it's an interpreted language not known for its speed. While I know of books about doing scientific work in Python and packages like NumPy and SciPy for it, it can't match the libraries (like IMSL, NAG, and vendor-supplied BLAS) available for significant numerical work in C(++) or Fortran. I'd much rather we use a mainstream scientific computing language that people will actually use for serious work, not a newer language that someone thinks people should be using for it, but that currently lacks the same scientific software support.
Now, I'm not sure about performance of python in comparison to fortran, but I am aware of a large array of scientific computing packages for python. I've toyed with a few of them over the past few days. I'm sure there is not the same degree of support, but some does exist. I'd be curious to see some benchmarks for relatively common computations.

That being said, I'd have to agree. It's not in common use yet. Will it be? I don't know. I'm assuming there are valid reasons why its not (ie performance).
 
I gather it's meant for rapid development, like MATLAB. It does have some support for scientific work, but it pales in comparison to C and Fortran, which are also fast compared to it. I've also seen people use Python (or perl) for bioinformatics, and theer are advantages when what one is doing is matching sections of genetic code (string manip.), or converting formats from a public database...but my work in computational genetics involves an out-of-core SVD. Python is not the language for that.

What do people think of my assertion that learning a compiled language has significant value? My first two languages were interpretede (BASIC, APL). I find it good for learning programming concepts but not as good for training people who can write and debug large, readable programs. You need to sit through a few weeks of compiler errors to really get the hang of things!
 
I gather it's meant for rapid development, like MATLAB. It does have some support for scientific work, but it pales in comparison to C and Fortran, which are also fast compared to it. I've also seen people use Python (or perl) for bioinformatics, and theer are advantages when what one is doing is matching sections of genetic code (string manip.), or converting formats from a public database...but my work in computational genetics involves an out-of-core SVD. Python is not the language for that.
I'll defer to your judgement on speed. I'll have to agree with speed of development. I'm finding it suprisingly easy to write.

arnisador said:
What do people think of my assertion that learning a compiled language has significant value? My first two languages were interpretede (BASIC, APL). I find it good for learning programming concepts but not as good for training people who can write and debug large, readable programs. You need to sit through a few weeks of compiler errors to really get the hang of things!
conceptually, I don't see any true benefit for studying a compiled language over any other, at least for the sake of learning. It would not prevent me from studying it before any other language, but I'd not give it special treatment just because its compiler oriented. I never studied BASIC in any form. I skipped over that in High School and went straight to the AP course (Pascal at the time).

I have a few problems with C(++). The compilers I've used have not been very clear in compiler errors. I TA'ed a few courses in college, and almost all of the questions I got were not about programming concepts, but were oriented around "What on earth does this compiler error mean?!" or "what the heck caused that segmentation fault?!". You spend an hour looking over a compiler error farting out at line 1345 only to realize that there was a silly typo back at line 564 (forgot a bracket, : for ;, lower case L for 1, etc). String processing is typically heart wrenching in C. The only real concern is that as a beginning student you spend more time debugging silly errors rather than really programming. Heck, I've been using C++ for a long time now, and I still sometimes have problems tracking down cryptic errors. I guess you get that with most compilers though :) I guess debugging is part of the learning process though. Teaches patience ;)
 
Back
Top