Jump to content


Photo

Python the most elegant programming language

Python elegant programming

  • Please log in to reply
No replies to this topic

#1 Neil

Neil

    Administrator

  • Administrators
  • 1,493 posts

Posted 20 January 2013 - 11:09 AM

Let me start by stating that I'm not a programmer.

 

However, I count myself lucky that I was born in time to be a teenager when the personal computer revolution started. My first computer was an ATARI 400 of which I still have a working version. My friends at the time all had ZX81s with the Zilog Z80A processor. I didn't know it but I already had a RISC processor in the 6502 which only had three registers and one of those was the accumulator!

 

I learn't to program very easily and can program in the following languages;

 

Basic, C, C++, Java and Python

 

Basic is something that we are learn  = Beginners All purpose Symbolic Instruction Code. But there are various version of it around the world now specific to different company's, some good, some bad!

 

You can't program computers for long without running into 'C' and C++. These taken together are the fundamental foundation of all computers and computing, there is no escaping their universal application throughout the world. If you want to write a program once that can be run on any machine / processor combination then it has to be done in C or C++. The trouble is that they are difficult languages to learn with powerful concepts that are all too easily compromised, so you really do need to be very familiar with them to excise proper control of them.

 

Enter Java! In the beginning Java came bring all sorts of promises; maintains the power of C++ whilst simplifying the coding and execution. In fact, it was really riding the internet wave it created with APPELETS. Java's main mantra was that everything should be a CLASS with its own objects etc... However, you still needed to write a lot of boiler plate code to get things to work and then you ran into the ANONYMOUS INNER CLASS... What a complete mess!

 

So here we are today looking at Python? Python takes a lot of its fundamentals from C and C++ but while making it more fun and easier to program. The other big benefit being that it also has a huge library of functions and modells again mostly inherited from C and C++.

 

Its call a scripting program because like BASIC you can run a program / script without the need to compile and link it. There is also a built-in interpreter where you can experiment with functions before  committing them permanently to code.

 

So your first steps if you want to follow along with our projects and examples is you download and install the following programs;

 

1. Python http://www.python.org/ (Download the 2.7.3 version that is suitable for your computer? 32bit or 64bit version)

2. Then get the pywin32 extentions at http://sourceforge.n.../files/pywin32/ (Again down load the correct version for your computer)

3. Finally, something for the future, download wxpython: http://www.wxpython.org/ (This will be used later to build a GUI interface!

 

There is a lot of information on the internet concerning python, when you have everything installed and up and running try playing around in the PythonWin program.

 

Here is your first script in the tradition of programming its an "Hello World" program

 

 

##

# This is a comment 

##

 

#!/usr/bin/python

 

def Test():

    print "Hello World"

 

if __name__ == '__main__':

    Test()

 

NOTE: All tabs are = 4x spaces.

 

Good luck and I hope you choose the follow along as we try to make a script to automate our image acquisition process.

 

Clear skies

 

 

Neil.







Also tagged with one or more of these keywords: Python, elegant, programming