Preface

This book provides an introduction to Python programming languege but at the same time serves as a reference. A tutorial is supposed to present matter in linear order while a reference presents subject in non-linear manner. I have attemmpted to provide a tutorial and reference both in this book. Python is a popular(as indicated by Stackoverflow popularity index or Tiobe language index or by github) open source language. It is used for wide variety of work from simple scripts to web applcations(websites) to artificial intelligence to machine learning to desktop GUI software, so on and so forth. It is free(Python license even allows you to modify it), portable(because it is not compiled to machine code), powerful(because it has all the features one need and comes with lots of libraries), dead simple and fun to program in. It is one of the fastest language in terms of developer productivity. What will take a month in C/C++ can be done in a week in Python. Thus, it is a great protoyping language for POC and MVPs. However, the real power of Python is simplicity because of which it is fast to market. In today's world the speed of development in Python gives a compnay stratgic advantages to its competitors. There is solid reason because of which many universities teach programming using Python as first language. Python also boasts huge number of libraries for AI/ML and is by far the most popular language to develop AI/ML applications.

Prerequisite

There is no programming experience required. However, it is expected that you know how to use your operating system and a text editor. Almost all programming editors and IDEs have Python support. I can suggest Emacs or VI or Visual Studiio Code(comes with lots of extensios and is easy to use) or even Visual Studio community/professional edition can be used. Emacs and VI take time to master and if you have not used them then it may be worthwhile to invest some time to learn them. I will start the books from basics and go slow explaining everything in between. After you finish this book you should feel at home with Python and apply your learnings in any application you choose to develop. Experience with git will be helpful when we start making projects in third part onwards.

Scope of the Book

This book is divided in several parts. First, I will introduce Python language facilities and syntax, followed by a reference to standard library by example. Then we will make web, desktop and AI projects in that order. We wil use readymade frameworks like Flask, Django, pygtk, Tensorflow, OpenCV etc.

The first part of this book is about syntax of Python programming language which closely follows the language reference from documentation of Python. The second part is about studying Python standard library by example.

About Me

I have been programming since 1999. I programmed in C/C++ for 16 years and then switched to Python/Javascript. These days I mostly write code in Python/Javsscript/SQL and have been learning Rust. I write books because I find that most books are not friendly to beginners. And those which are friendly to beginners do not cover advanced topics. My intention is to cover both sides of programming. I have presented most trivial examples to cover basic details and then go on increasing the complexity of examples later on as the reader gets more familiar and used to basics. Heavy usage of Python language reference is notable for the accuracy of the topics under discussion.

Acknowledgments

As with any book there are a lot of people involved with this book but not in traditional sense of a typical book. I have written this book using Docbook thus Norman Walsh deserves praise. xsltproc has been used to process xml to html and it is a wonderful piece of software written by James Clark. I have used Emacs to edit the xml source. The diagrams are drawn with asymptote. For syntax highlighting I have used BeautifulSoup and pygments. I chose server side rendering of code over Javascript library for faster rendering of content on low-end devices. Thanks for respective authors of these very nice pieces of software.

When I write math books I use Sphinx with KaTeX because docbooks has MathML which is not yet supported by all browsers.

I must say thanks to my family particularly to my parents, wife and my son whose precious time I have taken to write this book and gave them numerous trouble in general. They have been the major force which supported while writing it. This book would not have been possible without their support.

There have been many teachers in my life who have helped me with various lessons in life and otherwise. I will try to remember all of them here and seek forgiveness if I miss anyone. My math teachers Yogendra Yadav, Hriday Nayaran Singh and Satyanand Satyarthi have helped me a lot with basics of Mathematics. Anurag Johri, Sirnivasa Kotu, Shulin and Shreyas Majthia for their technical discussions and insight into programming. My professors S. Sen, S. Sengupta and T. K. Basu for showing faith in me during troubled times.

Since Python was developed by Guido van Rossum along with the developers of free software community all of them deserve applaud for their efforts on this fantastic language.

I am not native English speaker and it has gone through only one pair of eyes thus you should expect all kinds of errors, particularly related to punctuation. I would be glad if you could report all errors, suggestions and feedback to me at and those will be incorporated. Language Tool has been used for grammar checks and all as my English is pathetic, so you know whom to blame or appraise for mistakes.

Although I would like to give a pdf version of the book for download but the content keep changing and there will be just too many versions of the book. Thus, please read html version until a final release can be done.


© 2022 Shiv S. Dayal. www.ashtavakra.org. GNU FDL license v1.3 or later is applicable where not stated.