01 - Introduction to Python

1. About Python

Python has come a long way since its creation. When Python was created, there was a very small group of people that believed in it and predicted bright future of that creation. Nowadays there aren’t enough Python coders to do all the jobs. Major companies (Google, YouTube, DreamWorks, etc.) are constantly looking for talents to hire them. Many good things of Python programming language are mentioned below.

Python is a interpreted scripting language. It is processed at runtime by the Python interpreter and doesn’t need compiling. Python is a very good scripting language that spares time by avoiding compile process. However you can compile your scripts into byte-code when building large applications and projects, to increase speed of executing. Actually scripts are automatically compiled into byte-code (script extension is then .pyd) when you include them into your current script. In that case you can use other scripts as compiled libraries. This concept of including is maybe unclear to you if you’re completely beginner, but we will get to it later.

Supports object-oriented programming, which enables you to encapsulate your code within objects. In fact, in Python everything is an object, including even basic data types. Objects have their type, id and value, without exceptions. Because of those attributes you can always know which methods you can use with some specific object, how it will be printed to the screen, how it will behave in certain methods and roles, etc. You’ll find more about that in next chapters.

Another good thing about Python is that Python is an interactive programming language. When you install Python, you can start it inside prompt (in Windows command prompt - cmd, simply type keyword python to start) and directly write your programs. Interactive mode is very good thing during learning process, where you can see output simply after typing few lines of code. Python also comes with program called Idle, which is User interface for Python shell, i.e. easier way to run your python scripts if you’re not familiar with shell scripting and want to avoid typing in interpreted way of Python. Using Idle, you can write your scripts and run it by pressing Run button. After that you’ll see output of your script. You will find out how to install Python and start it in shell in the next chapter.

Python is designed with idea that programmer will spend more time to read and debug program, than to write it. That’s the reason why Python is so readable and beginner friendly. There are also no pointers and references, so you don’t have to worry about memory access, stack and similar things which are always problem to beginners. In fact, you can program even without knowing anything about that. With Python you’ll get into the programming world very easily and you are going to love it.

Another good thing of Python is that it is extendable and portable and has support for almost everything. You can send emails via python, make games, configure databases, make web applications, maintain servers, make guis, desktop apps, etc... almost everything.

Portability gives you freedom to write your code on one platform and execute it on another, in completely same environment, in the same way and without fear that something will go wrong. You can write your scripts using Windows and execute them on Linux, etc.

You can easily extend your script simply by importing modules with magic word import and specifying module name. If module is in your python path it will be added, and that’s it. Python path is system variable that tells Python interpreter where to find modules if they are not in the same directory as the script you’re executing. Anyway, simplicity is what characterizes Python.

Python also supports automatic garbage collection, which means you don’t have to worry about deleting objects that you’re not going to use anymore, about closing opened files and similar things. If you’re not going to use some object more in the code and you forget to delete it, memory will be occupied with no purpose and this can be problem if you’re running your script on platform with low memory. Garbage collector will automatically delete this object after some time and free your memory. Also if file is left open, then it can’t be used by another program. Python closes it. It makes programming a lot more easier and gives you time to think about programming and how to make something, freeing you of unnecessary stuff.

There are few editions of python, depending on which language they are written in. Mostly used is Python, which is written in C. There is also Jython, written in Java, IronPython in C# and others. Python is the fastest one and is recommended for using.

Python is high level language which will give you freedom and enjoyment in programming. You will not have to worry about low level things - how data is stored in memory, how functions are called, which objects belong to which data type and some background processes, etc.

Those were some main characteristics of Python. I hope you’ll enjoy using it. Wish you luck!