Skip to main content

Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability. Use the python tag for all Python related questions. If you believe your question may be even more specific, you can include a version specific tag such as python-3.x.

Python is a dynamic and strongly typed programming language that is used for a wide range of applications. It is a general-purpose, high-level programming language that is designed to emphasize usability.

Python allows programmers to express concepts in fewer lines of code than would be possible in languages such as , and the language has constructs intended to be used to create clear programs in a variety of domains.

Two similar but incompatible major versions of Python are in widespread use: 2.7 is supported until 2020 to run old scripts and dependencies, and version 3 first came out in 2008. Please mention the version and implementation that you are using when asking a question about Python.

Python supports multiple programming paradigms, including object-oriented, imperative, and functional programming styles. It features a fully dynamic type system and automatic memory management, similar to that of , , and .

Like other dynamic languages, Python is often used as a scripting language, but is also used in a wide range of non-scripting contexts. Using third-party tools, Python code can be packaged into standalone executable programs. Python interpreters are available for many operating systems.

CPython, the reference implementation of Python, is free and open source software and has a community-based development model, as do nearly all of its alternative implementations. There are a wide variety of implementations more suited for specific environments or tasks.

The philosophy of Python is succinctly formulated in The Zen of Python written by Tim Peters, which can be revealed by issuing this command at the interactive interpreter:

>>> import this

The documentation can also be accessed offline for your installation of Python in the following manner:

  1. Going into Your_Python_install_dir/Doc. There is a complete Python documentation present for the version of Python installed on your computer.
  2. Running pydoc x or python -m pydoc x from the command prompt or terminal displays documentation for module x.

Unlike many other languages Python uses an indentation based syntax and this may take some getting used to for programmers familiar with braces for syntax.

>>> from __future__ import braces
  File "<stdin>", line 1
SyntaxError: not a chance

To help with the transition, it is recommended to use a properly configured text editor created for programmers or an IDE. Python comes with a basic IDE called IDLE to get you started. Other popular examples are the charity-ware Vim, the free GNU and +PyDev. Take a look at this IDE comparison list for many other alternatives.

Tagging recommendation:

Use the tag for all Python related questions. If you believe your question may be even more specific, you can include a version specific tag such as .


Popular web frameworks based on Python

  • Django

    The Web framework for perfectionists (with deadlines). Django makes it easier to build better Web apps more quickly and with less code. Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. It lets you build high-performing, elegant Web applications quickly. Django focuses on automating as much as possible and adhering to the DRY (Don't Repeat Yourself) principle.

  • Flask

    Flask is a micro-framework for Python based on Werkzeug, Jinja 2, and good intentions.

  • CherryPy

    CherryPy is a pythonic, object-oriented web framework that enables developers to build web applications in much the same way they would build any other object-oriented Python program. This results in smaller source code developed in less time. CherryPy has been in use for over 7 years, and it is being used in production by many sites, from the simplest to the most demanding.

  • Pyramid

    A lightweight Web framework emphasizing flexibility and rapid development. It combines the very best ideas from the worlds of Ruby, Python and Perl, providing a structured but extremely flexible Python web framework. It is also one of the first projects to leverage the emerging WSGI standard, which allows extensive re-use and flexibility, but only if you need it.

  • is a web framework for Python that is as simple as it is powerful. is in the public domain; you can use it for whatever purpose with absolutely no restrictions. lets you write web apps in Python.

  • Grok

    Grok is built on the existing Zope 3 libraries, but aims to provide an easier learning curve and a more agile development experience. It does this by placing an emphasis on convention over configuration and DRY (Don't Repeat Yourself).

Popular Mathematical/Scientific computing libraries in Python

  • NumPy

    NumPy is the fundamental package for scientific computing with Python. It contains among other things:

    • a powerful N-dimensional array object
    • sophisticated (broadcasting) functions
    • tools for integrating C/C++ and Fortran code
    • useful linear algebra, Fourier transform, and random number capabilities

    These features also make it possible to use NumPy in general-purpose database applications.

  • SciPy

    SciPy is an open source library for the Python programming language consisting of mathematical algorithms and functions often used in science and engineering. SciPy includes algorithms and tools for tasks such as optimization, clustering, discrete Fourier transforms, linear algebra, signal processing and multi-dimensional image processing. SciPy is closely related to NumPy and depends on many NumPy functions, including a multidimensional array that is used as the basic data structure in SciPy.

  • matplotlib

    matplotlib is a plotting library for the Python programming language and its NumPy numerical mathematics extension. It provides an object-oriented API for embedding plots into applications using general-purpose GUI toolkits like wxPython, Qt, or GTK. There is also a procedural "pylab" interface based on a state machine (like OpenGL) designed to closely resemble that of MATLAB.

  • pandas

    pandas, the Python Data Analysis Library, is an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.

Other Sites

Free Python programming Books

Interactive Python learning

  • Python Monk - Interactive Python learning in the browser
  • Codeacademy - Learn the fundamentals of Python and dynamic programming
  • CodeSkulptor - Interactive online IDEfor Python programming
  • Coursera - Online course for introduction to interactive Python programming
  • CheckiO - Game world you can explore using your Python programming skills
  • - Online interpreter for Python that it allow saving code for later demonstration

Python Online Courses

Python for Scientists

Code Language (used for syntax highlighting): lang-py