View Full Version : Is there a trend to code in Python instead of C++?
08-07-2006, 04:56 AM
I mean for tasks where Python will do just fine.
Based on both shortage of C++ developers and the fact that C++ might be an overkill for those tasks.
08-07-2006, 07:31 PM
Not sure about a trend but I'd say python is less maintanance purely because it doesn't need compiling. Also, mundane system type tasks are very easy with pythons 'os' and 'system' modules which have no real standardized equivelent in c++.
08-08-2006, 09:05 AM
You also get the benefit that you can code Python modules in C++, then just glue them together with Python. You then get the speed of C++ (if the slow stuff is in the module) with the convenience of Python. I think more 3d software will be going this way.
You also get regular expressions which are very useful. Although not quite as easy to use as from Perl.
08-08-2006, 08:27 PM
Python certainly excels as a glue language, and beyond that I think people are gradually cottoning on to the fact that dynamic languages like Python and ruby and <insert your favourite dynamic language here> are a Good Thing -- expressive, succint, and powerful, with none of the overhead of a clumsy compile/link cycle.
There are also intangible benefits. Programming in Python is just somehow satisfying in a way that C++ (my native tongue) will never quite be (although writing super-performant C++ is fun in its own way). It's partly aesthetics: the code just looks good to me -- clean, uncluttered, abstract, simple. But those qualities have practical implications, too -- it's easier to maintain, easier to spot bugs in, easier to understand. Python is sometimes called executable pseudo-code with good reason.
A personal case study: I spent 3 weeks writing a dependency graph library in C++, and ended up with a complex mess. I could have untangled it given another week or two, but instead I re-implemented it in Python, and it took me _two hours_ -- a huge win. Now, granted, it wouldn't be near as fast as the equivalent C++ version, but the dg layer didn't have to be very quick -- 99% of the CPU time was spent inside image processing functions.
One final piece of advocacy -- I figure if it's good enough for Google, it's good enough for me. Python is one of the 3 official development languages at Google (along with C++ and Java).
08-08-2006, 09:29 PM
I wouldn't know if it is being used more often as a solution for coding over C++, but it sure seems to be gaining more support in graphics. For example, you have the Python in Softimage XSI, Python in Motionbuilder, Python in Blender, Python Imaging Library, Computer Graphics Kit in Python, and PyOpenGL.
A year ago, I probably would have argued for gritting through the C/C++ workload. Having coded a little in C++ and Python, I personally wouldn't hesitate to try to code a prototype in Python before worrying about C++. Yes, C++ will have the faster execution on most tasks and that will keep C++ seated as the optimization language of choice for a long time. However, when we talk about computer speed, we often only need things to work fast enough, not "as fast as possible". We're talking fragments of a millisecond in many cases. Unless you code C++ in your sleep, you're going to design a solution in Python much faster. The ease of use in scripting was verified in a college study where students were divided into two test groups. One learned scripting first and the other learned a full programming language such as C++ or Java. The study showed that the scripting group grasped the programming concepts in scripting far faster than the full programming language group. I would site the study, but it was a couple years ago. I don't think anyone is trying sell Python as a being flat out superior to C++. With the wide range of support, I suspect Python will be a popular glue/prototyping tool for cg in the very near future. If you want to see a comparison of scripting languages and "system level" languages, you can read this study here - http://www.cis.udel.edu/~silber/470STUFF/article.pdf
It should help clarify a few things.
08-09-2006, 05:29 AM
08-09-2006, 05:29 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.