Download Python

yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts

Go (programming language) wikipedia, lookup

Object-oriented programming wikipedia, lookup

C Sharp (programming language) wikipedia, lookup

C Sharp syntax wikipedia, lookup

Programming language wikipedia, lookup

Java performance wikipedia, lookup

Java (programming language) wikipedia, lookup

Program optimization wikipedia, lookup

Python (programming language) wikipedia, lookup

Name mangling wikipedia, lookup

C syntax wikipedia, lookup

Control flow wikipedia, lookup

One-pass compiler wikipedia, lookup

Scala (programming language) wikipedia, lookup

Interpreter (computing) wikipedia, lookup

Resource management (computing) wikipedia, lookup

Comment (computer programming) wikipedia, lookup

String literal wikipedia, lookup

Reserved word wikipedia, lookup

Python syntax and semantics wikipedia, lookup

ALGOL 68 wikipedia, lookup

Perl 6 wikipedia, lookup

Henry Armstrong
Andy Burras
Everett Hite
• First released in 1991 by Guido van Rossum
• Designed around a philosophy which emphasized readability and
importance of programmer effort over computer effort
• Minimalist syntax and semantics
• Large standard library is comprehensive
• It was influenced by ALGOL 68, C, Lisp, Perl and Java
• It was originally developed for UNIX scripting, but eventually grew
beyond these bounds
• Multi-paradigm language focusing on functional, object oriented and
• Has a fully dynamic type system. This means that type checking is
done during runtime
• Variables are strongly typed. This forbids operations which make
little or no sense (i.e.; cannot perform int + char)
• Has automatic memory management
• Has a highly readable, uncluttered language. Uses many English
keywords where other languages use punctuation
• YouTube and the original BitTorrent client were programed in
• Google and NASA use python for a variety of things
• Python is embedded in a number of software packages including
ArcGIS (a GIS package) and Maya (a high-end 3D animation
• Python is also used for scripting in a number of video games,
including Civilization IV, Eve Online and Battlefield 2
Code Example
print "This is a factorial program.“
n = -1
#Initialize n for error checking
while n < 0:
#Ensure that only nonnegative numbers will be accepted
n = input( "What number do you want to factorialize?" )
temp = n
count = n – 1
#Initialize return value (temp) and the counter
if n == 0:
temp = 1
count = 0
#Account for special case 0! = 1; set temp, count to 1
while count > 0: #Calculate n factorial
temp = temp * count
count = count – 1
print n,"! =",temp #Print result
Comparison to Other Languages
The following programs will count from 0 to 1000000
and print them out to a file
For i in xrange(1000000):
#include <iostream.h>
#include <fstream>
using namespace std;
int main(int argc, char *argv[]){
ofstream out;"/tmp/scratch");
for(int i = 0; i < 1000000;
out << i;
public class test{
public static void main(String[] args){
File f = new File("/tmp/scratch");
PrintWriter pw = new PrintWriter(new BufferedWriter(
new FileWriter(f)));
for(int i = 0; i < 1000000; i++){
catch(IOException ioe){
Comparisons (cont’d)
To Java:
• Python typically run slower than equivalent Java programs
• The development process for Python is significantly shorter than that of Java
• Actual code length of Python is 3-5 times shorter than equivalent Java code
To C++:
• Python compared to C++ is similar to Python compared to Java, just to a greater
• Actual code length of Python is 5-10 times shorter than equivalent C++ code
• Python is sometimes referred to and used as a glue language that combines several
component written in C++
To Perl:
• Both share similar roots (Unix, scripting), and similar features.
• Perl is harder to maintain based off the sometimes cryptic syntax and multiple