Introduction to Python

What is Python

Python is an interpreted high-level programming language for general-purpose programming. Created by Guido van Rossum and first released in 1991. Python is not named after the snake. It’s named after the British TV show Monty Python.

History of Python

Van Rossum 2006 (OSCON)
 O’Reilly Open Source Convention

Python was conceived in the late 1980s and began its life journey in December 1989 by Guido van Rossum. Guido took inspiration from ABC and SETL programming. Guido remains Python’s principal author. His continuing central role in Python’s development is reflected in the title given to him by the Python community: Benevolent Dictator for Life (BDFL) – a post from which he gave himself permanent vacation on July 12, 2018.


On the origins of Python, Van Rossum wrote in 1996:
…In December 1989, I was looking for a “hobby” programming project that would keep me occupied during the week around Christmas. My office would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python’s Flying Circus).

Python 2.0 was released on 16 October 2000 and had many major new features, including a cycle-detecting garbage collector and support for Unicode. With this release, the development process became more transparent and community-backed.

Python 3.0 (initially called Python 3000 or py3k) was released on 3 December 2008 after a long testing period. It is a major revision of the language that is not completely backward-compatible with previous versions.

However, many of its major features have been back ported to the Python 2.6.x and 2.7.x version series, and releases of Python 3 include the 2 to 3 utility, which automates the translation of Python 2 code to Python 3. Python 2.7’s end-of-life date was initially set at 2015, then postponed to 2020 out of concern that a large body of existing code could not easily be forward-ported to Python 3

Philosophy of python

Python has a design philosophy that emphasizes code readability, notably using significant whitespace. It provides constructs that enable clear programming on both small and large scales.
Python features a dynamic type system and automatic memory management.

It supports multiple programming paradigms, including object-oriented, imperative, functional and procedural, and has a large and comprehensive standard library Python is a multi-paradigm programming language. Object-oriented programming and structured programming are fully supported, and many of its features 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. It also features dynamic name resolution (late binding), which binds method and variable names during program execution.

Python’s design offers some support for functional programming in the Lisp tradition. It
has filter(), map(), and reduce() functions; list comprehensions, dictionaries, and sets; and
generator expressions.

The standard library has two modules (itertools and functools) that implement functional tools borrowed from Haskell and Standard ML. The language’s core philosophy is summarized in the document The Zen of Python (PEP 20), which includes aphorisms such as:

  • Beautiful is better than ugly
  • Explicit is better than implicit
  • Simple is better than complex
  • Complex is better than complicated
  • Readability counts

Rather than having all of its functionality built into its core, Python was designed to be highly extensible. This compact modularity has made it particularly popular as a means of adding programmable interfaces to existing applications. Van Rossum’s vision of a small core language with a large standard library and easily extensible interpreter stemmed from his frustrations with ABC, which espoused the opposite approach.

What is Pythonic

A common buzzword in the Python community is pythonic, which can have a wide range of meanings related to program style. To say that code is pythonic is to say that it uses Python idioms well, that it is natural or shows fluency in the language, and that it conforms to Python’s minimalist philosophy and emphasis on readability.

In contrast, code that is difficult to understand or reads like a rough transcription from another programming language is called unpythonic. Users and admirers of Python, especially those considered knowledgeable or experienced, are often referred to as Pythonists, Pythonistas, and Pythoneers.

Libraries

Python’s large standard library, is commonly cited as one of its greatest strengths, provides tools suited to many tasks.

As of March 2018, the Python Package Index (PyPI), the official repository for third-party Python software, contains over 130,000 packages with a wide range of functionality,
including:

  • Graphical user interfaces
  • Web frameworks
  • Multimedia
  • Databases
  • Networking
  • Test frameworks
  • Automation
  • Web scraping
  • Documentation
  • System administration
  • Scientific computing
  • Text processing
  • Image processing

Why Python

Since 2003, Python has consistently ranked in the top ten most popular programming languages in the TIOBE Programming Community Index where, as of January 2018, it is the fourth most popular language (behind Java, C, and C++). It was selected Programming Language of the Year in 2007 and 2010.


An empirical study found that scripting languages, such as Python, are more productive than conventional languages, such as C and Java, for programming problems involving string manipulation and search in a dictionary, and determined that memory consumption was often “better than Java and not much worse than C or C++”.

Large organizations that use Python include Wikipedia, Google, Yahoo!, CERN, NASA, Facebook, Amazon, Instagram, Spotify. The social news networking site Reddit is written entirely in Python.

Web frameworks like Django, Pylons, Pyramid, TurboGears, web2py, Tornado, Flask, Bottle and Zope support developers in the design and maintenance of complex applications. SQLAlchemy can be used as data mapper to a relational database.

Twisted is a framework to program communications between computers, and is used (for
example) by Dropbox. Libraries such as NumPy, SciPy and Matplotlib allow the effective use of Python in scientific computing, with specialized libraries such as Biopython and Astropy providing
domain-specific functionality.

SageMath is a mathematical software with a “notebook” programmable in Python: its library covers many aspects of mathematics, including algebra, combinatorics, numerical mathematics, number theory, and calculus.

Python has been successfully embedded in many software products as a scripting language, including in finite element method software such as Abaqus, 3D parametric modeler like FreeCAD, 3D animation packages such as 3ds Max, Blender, Cinema 4D, Lightwave, Houdini, Maya, modo, MotionBuilder, Softimage, the visual effects compositor Nuke, 2D imaging programs like GIMP, Inkscape, Scribus and Paint Shop Pro, and musical notation programs like scorewriter and capella. GNU Debugger uses

Python has been used in artificial intelligence projects. As a scripting language with modular architecture, simple syntax and rich text processing tools, Python is often used for natural language processing.

Many operating systems include Python as a standard component. It ships with most Linux distributions, AmigaOS 4, FreeBSD, NetBSD, OpenBSD and macOS, and can be used from the command line (terminal).

Python is used extensively in the information security industry, including in exploit development.