real world examples & python
Duncan Booth
duncan at NOSPAMrcp.co.uk
Thu May 31 11:31:36 EDT 2001
thefireinside at hotmail.com (Steve Keri) wrote in
news:ea903c3a.0105310123.61143fe2 at posting.google.com:
> Can someone give me examples of apps you can develop with scripting
> languages and maybe give examples of programs that are not a good idea
> w/ python and it should be left up to C++ and VB. Thanks a lot!
>
> -Steve
If you positively cannot write it in Python, use C/C++/Assembler, whatever
is appropriate. This applies to device drivers, and interfacing to other
languages/libraries or environments where no Python interface exists.
Restrict the non-Python part of the program to the minimum possible.
Then write the rest of your application in Python. This includes all speed
critical parts.
Then refactor the speed critical parts of the Python application where they
are too slow, speeding them up as far as Python allows.
Finally is any parts of your application are still too slow, rewrite those
parts ONLY in C or C++ (and unless the total run time you save over the
life of the program exceeds the time taken to recode in C/C++, you
shouldn't even consider recoding it).
typical examples of apps you should write in Python:
heavy duty number crunching (See the numeric extensions)
shoot-em up video games (See the PyGame extensions)
low level system processes (See PythonService for NT services)
plus all the obvious ones...
typical examples of apps you should not write in Python:
anything where the customer absolutely insists on another language.
anything that depends heavily on a large pre-existing library where no
Python interface exists and the total time to write all required
applications in the language for which the interface does exist is
clearly less than the time to write the Python interface and apps.
applications where you have no control over the target environment,
and Python may not be available. For example you cannot assume that
Python will be available for scripting web pages unless you have full
control over the target environment, so Javascript could be a better
choice in these cases.
--
Duncan Booth duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
More information about the Python-list
mailing list