[Tutor] I am not really convinced using Python...

Alan Gauld alan.gauld at freenet.co.uk
Wed Jul 26 01:25:27 CEST 2006


>  I am not a newbie to programming.I already learnt C language.I 
> enjoyed it a lot.
>  But I am not a computer student.So I don't require a hifi language 
> like C.

C is a tterrible language for computer students, its usually used by
engineering types who need to interact with the computer  at a low
level. C is full of what computer scientists view as very bad 
practice!

>  I am an electronics student.I would really like to know if the
> language like Python will be of any help(use) to me

As an electronics grad who workds in telecoms designing large scale
software systems I'll try to answer! :-)

It is extremely useful for modelling problems - if you already use
tools like mathematica to build math models of waveshapes,
filter characteristics, stochastic noise models, data traffic
analyses,  etc etc Python can do all that too.

For general purpose programming Python can build all your
test harnesses, integrate your code libraries, manage your project 
files etc.

For network access there are very good socket and serial port 
libraries
and a bunch of internet protocols supported, it can also use a pile
of more obscure libraries contributed by others - I've seen HPIB, 
Centronics
and S-COM interface libraries and several others have been discussed 
on this list.

Where its not so great is in building bespoke interfaces to new
hardware - there are no direct input/output peek/poke type functions,
no direct memoruy access etc. The usual silution is build a thi access
library in C then wrap that as a Python module with the higher level
interface functions written in python and calling the hardware 
routines in C.

> .Also I heard that it is an intrepeter language.
>  Is it true?

Yes in the same sense that Java, C#, Perl and Smaltalk are 
interpreted.
The code is compiled into byte code and then run in a virtual machine
interpreter. There are even translators from python to Java byte code
so you can run it on any JVM and integrate with all the Java libraries
out there.

> If yes I would like to know whether it is fast or not.

Try it and see. The answer will depend on what you are doing,
what your computing architecture is and how well you write the code.
If its not fast enough you can usually idfentify the bottleneck and
rewrite that part in C. Python was explicitly designed with that style
of build it, tune it, rewqrite the bottlenecks type of development 
cycle
in mind. Only Tcl is better suited to that kind of tweaking IMHO.

> Also I would like to know the capabilities of Python.

It can do most things, and usually more easily than in other
languages but have a look at the python web page, there are
lots of advocacy stories and case studies there.

>  (If I am really convinced I would use it for my life)..

No language is perfect and you will likely find it easier to have
several languages to use as appropriate. But Python can do the lions 
share.

Personally I now use Python 70%, Delphi 15%, C/C++/ObjectiveC 10%
and a variety of others(Tcl, Awk, Java, Smalltalk, Lisp etc) for the 
final 5%

HTH,

Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list