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 c, 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 scheme, ruby, perl and tcl.
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:
- Going into
Your_Python_install_dir/Doc. There is a complete Python documentation present for the version of Python installed on your computer.
python -m pydoc xfrom the command prompt or terminal displays documentation for module
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 emacs and eclipse+PyDev. Take a look at this IDE comparison list for many other alternatives.
- Official documentation for the current stable versions: 2.7 and 3.
- Python (programming language) (Wikipedia)
- Python for Programmers
- Python - Quick Guide
- Porting Python 2 Code to Python 3
- The non-profit Python Software Foundation manages CPython.
- PSF License Agreement for Python 2.7 and 3
Popular web frameworks based on Python
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 is a micro-framework for Python based on Werkzeug, Jinja 2, and good intentions.
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.
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.
web.py is a web framework for Python that is as simple as it is powerful. web.py is in the public domain; you can use it for whatever purpose with absolutely no restrictions. web.py lets you write web apps in Python.
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 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 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 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, 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.
- Tutor mailing list
- python-help mailing list
- Python Weekly
- Pycoder's Weekly
- Python Google Group
Free Python programming Books
- Wikibooks' Non-Programmers Tutorial for Python
- The Official Python Tutorial
- Building Skills in Python Version 2.6 (Steven F. Lott)
- A Byte of Python (Swaroop C H.)
- Data Structures and Algorithms in Python (Bruno R. Preiss)
- Dive into Python
- Dive into Python 3
- How to Think Like a Computer Scientist: Learning with Python (Allen Downey, Jeff Elkner and Chris Meyers)
- Invent Your Own Computer Games With Python (Al Sweigart)
- Learn Python The Hard Way (Zed A. Shaw)
- Making Games with Python & Pygame (Albert Sweigart)
- Natural Language Processing with Python (Steven Bird, Ewan Klein, and Edward Loper)
- Python Bibliotheca
- Python for Fun (Chris Meyers)
- Snake Wrangling For Kids (Jason R. Briggs)
- Think Python (PDF file) (Allen Downey)
- Porting to Python 3 (Lennart Regebro)
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
- Repl.it - Online interpreter for Python that it allow saving code for later demonstration
Python Online Courses
- Programming for Everybody - Introduction to programming using Python.
- An Introduction to Interactive Programming in Python - The name explains itself.