In [ ]:
#Inside a python console
import this
Python is a programming language that lets you work more quickly and integrate your systems more effectively. You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs.
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed.
In [ ]:
# execution semantics
for i in range(10):
print i**2
print "Outside for loop"
In [ ]:
# dynamic binding
my_str = "hola"
type(my_str)
In [ ]:
# dynamic binding
my_str = 90
type(my_str)
In [ ]:
# fully dynamic typing
4 +5 +6
In [ ]:
# fully dynamic typing
4 + "hola"
In [ ]:
## TOOLS
**CPython** is the real name of default standard Python implementation
- The interpreter is deployed together with standard library
- It can take a file as argument to run. Otherwise it opens and interactive console
- With '-m' parameter you can execute directly certain modules (debugging, profiling)
- Implemented in C
There are Python implementations in other languages:
- Jython: Python 2.5 interpreter written in Java which runs bytecode in the JVM
- IronPython: Similar approach for .NET Common Language Runtime
- JS, C++, CIL...
- Stackless Python: CPython fork with microthreads concurrency
- PyPy: Python 2.7 interpreter implemented in Python. Really fast, multi-core...!!!
**IPython**: create a comprehensive environment for interactive and exploratory computing
An enhanced interactive Python shell
An architecture for interactive parallel computing:
- Other powerful interactive shells (terminal and Qt-based)
- A browser-based notebook with support for code, text, mathematical expressions
inline plots and other rich media
- Support for interactive data visualization and use of GUI toolkits
- Flexible, embeddable interpreters to load into your own projects
- Easy to use, high performance tools for parallel computing
- Recently funded with $1.15M from the Alfred P. Sloan Foundation
**virtualenv**: a tool to create isolated Python environments
It simply changes your PATH environment var to point to a different folder
**PyPi**: The Python Package Index is a repository of software for the Python programming language.
There are currently 89324 packages here.
The packages are 'eggs'.
**pip**: A tool for installing and managing Python packages
It installs packages from PyPi, local folders or Git and other repositories
It can read a list of packages from a file or generate the list of installed packages
IDE?