Quick Introduction

First a little bit of history…

from Wikipedia ^^

Python was conceived in the late 1980s and its implementation started in December 1989 by Guido van Rossum (Benevolent Dictator for Life) at CWI in the Netherlands as a successor to the ABC language.

Python is a multi-paradigm programming language, rather than forcing programmers to adopt a particular style of programming, object-oriented programming and structured programming are fully supported, and there are a number of language features which support functional programming and aspect-oriented programming.

Python uses dynamic typing and a combination of reference counting and a cycle-detecting garbage collector for memory management. An important feature of Python is dynamic name resolution (late binding), which binds method and variable names during program execution.

New built-in modules can be easily written in C, C++ or Cython. Python can also be used as an extension language for existing modules and applications that need a programmable interface.

By the way, the name Python, comes from the Monty Python british comedian group.

Now a very quick introduction to packaging…

(from http://www.aosabook.org/en/packaging.html)

There are two schools of thought when it comes to installing applications.

1st

Common to Windows and Mac OS X, is that applications should be self-contained, and their installation should not depend on anything else, this means that each application should be package with all of its dependencies.

2nd

The norm for Linux-based systems, treats software as a collection of small self-contained units called packages. Libraries are bundled into packages, any given library package might depend on other packages. Installing an application might involve finding and installing particular versions of dozens of other libraries. These dependencies are usually fetched from a central repository that contains thousands of packages.

This philosophy is why Linux distributions use complex package management systems like dpkg and RPM to track dependencies and prevent installation of two applications that use incompatible versions of the same library.

There are pros and cons to each approach. Having a highly modular system where every piece can be updated or replaced makes management easier, because each library is present in a single place, and all applications that use it benefit when it is updated.

Python’s packaging system was intended to make the second philosophy, and that is why there is several Python Enhancement Proposals (PEP) to improve this process.

It is very interesting to understand the problems that packaging in python faces, I strongly recommend reading the document from the link. And also visit the following address http://pypi.python.org/pypi, which is the public repository for python applications.

The Interpreter

(from http://stackoverflow.com/questions/441824/java-virtual-machine-vs-python-interpreter-parlance and http://docs.python.org/tutorial/interpreter.html)

Python is an interpreted language, this means that our applications (or scripts) are not compiled, they are interpreted, converted to bytecode and then executed. Using the python interpreter frees the programmer from thinking in terms of primitive data types, because pausing before the execution of each operation allows the determination of primitive data types for each variable in runtime (dynamically typed variables). The main difference between python and java, is that java allows the compilation of the applications to machine instructions  and the result is speed and resource efficiency. Python however allows extending the interpreter with new functions and data types implemented in C or C++ (or other languages callable from C). We will get back at this later.

Strongly recommend reading the sources for this topic.

Using the interpreter:

Modules

(from http://docs.python.org/tutorial/modules.html and http://effbot.org/zone/import-confusion.htm)

A module is a file containing Python definitions and statements. The file name is the module name with the suffix .py appended.Within a module, the module’s name (as a string) is available as the value of the global variable __name__, and this module can be imported using import and the file name.

If you have a file named shrubbery.py, then what you do to import it is

>>> import shrubbery

after this, you are able to use the resources defined inside the shrubbery module, this is the simplest form to import a module in python. We can also use:

>>> import shrubbery.concieve
>>> import shrubbery.design

in this case we are only importing concieve and design symbols from the shrubbery module. So this is all to explain that you can have your application divided through several files and import each functionality or all functionalities (lets call it symbols) from any given file, and that is how the python library is built.

Note: For efficiency reasons, each module is only imported once per interpreter session.

For the first post, i think it is enough, lets follow with an hello world or how to say NI. Please look deep in the links I have posted, in there you can find allot more information about these subjects.

Hope you guys find this blog useful and if there is any information here that is not correct or if you feel we should add anything, please comment or send me a message.

Thank you

About these ads

About Joao Lopes

I'm a software engineer at Universal Postal Union, with an interesting consultant background. I am very enthusiastic about science and technology and in my blog, I will try to report my introduction to Python experience, starting from scratch. You can check my professional profile here: http://ch.linkedin.com/in/jnlopes View all posts by Joao Lopes

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

jobhunthero

Job Search, Resume and Interview advice from the trenches...

Cocheno

Another Python Tutorial

Engineer's Journey

From Master to Journeyman

Inside Python

Another Python Tutorial

Rui Jarimba

Yet another geek blog about software development

Follow

Get every new post delivered to your Inbox.

Join 34 other followers

%d bloggers like this: