Python script and C++

nepBabu.cx nepbabu.cx at gmail.com
Tue Nov 28 02:06:21 CET 2006


Thuan Seah Tan wrote:
> Hi all,
> 
>     I am new to python  and currently I am working on a traffic simulation 
> which I plan to define the various agents using scripting. It's kind of like 
> scripting for non-playable character in games. I am thinking of using python 
> for this but I am concerned with running time. Is scripting a lot slower 
> compared to direct implementation in C++? Does compiling the script help in 

"Learning Python" is a good book to start learning Python. I don't think
you'll be better off in C++. If speed is of utmost importance for the
whole implementation, then I suggest C++ but well coded Python runs
atleast/near to C++ implementation. Otherwise, you can atleast code the
speed-savvy part of the implementation in C++. Ofcourse, Python object
model is based on a virtual machine (called PVM) which accounts for
slower start-up due to native function call conversion but you'll find
that learning curve is only a tiny fraction compared to C++.  And you'll
surely love Python. =)

> any way? Also, can anyone recommend me a book that covers python in general 
> as well as C++ binding? Thanks.

"Progamming in Python" is another excellent book that might be of help.
If you are developing on windows machine then
http://aspn.activestate.com/ASPN/Python has some helpful recipes.

C++ bindings in Python are handled by extending python objects and
manipulating it from C++ codes using the Python headers.

Also, http://python.org/docs should be a good reference.
Also Google for "vaults of parnassus" and Fredrik lundh's guide on Python.

Goodluck!


-- 
thanks,
nepBabu.cx
 	  c c
     .-.,;(")
.'`~C.-.c =W=




More information about the Python-list mailing list