Python - PowerPoint PPT Presentation

About This Presentation
Title:

Python

Description:

First released in 1991 by Guido van Rossum ... a number of video games, including Civilization IV, Eve Online and Battlefield 2 ... – PowerPoint PPT presentation

Number of Views:136
Avg rating:3.0/5.0
Slides: 9
Provided by: bur76
Learn more at: https://www.cse.sc.edu
Category:
Tags: eve | online | python

less

Transcript and Presenter's Notes

Title: Python


1
Python
  • Henry Armstrong
  • Andy Burras
  • Everett Hite

2
History
  • 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

3
Concepts
  • Multi-paradigm language focusing on functional,
    object oriented and imperative
  • 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

4
Implementations
  • YouTube and the original BitTorrent client were
    programed in python.
  • 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 package)
  • Python is also used for scripting in a number of
    video games, including Civilization IV, Eve
    Online and Battlefield 2

5
Code Example
print "This is a factorial program. n -1
Initialize n for error checking while n lt 0
Ensure that only nonnegative numbers will be
accepted n input( "What number do you want
to factorialize?" ) temp n Initialize
return value (temp) and the counter count n
1 if n 0 Account for special case 0!
1 set temp, count to 1 temp 1 count
0 while count gt 0 Calculate n factorial
temp temp count count count 1 print
n,"! ",temp Print result
6
Comparison to Other Languages
The following programs will count from 0 to
1000000 and print them out to a file
Java import java.io. public class test
public static void main(String args) try
File f new File("/tmp/scratch")
PrintWriter pw new PrintWriter(new
BufferedWriter( new
FileWriter(f))) for(int i 0 i lt
1000000 i) pw.print(i)
pw.close() catch(IOException ioe)
ioe.printStackTrace()
Python fopen(/tmp/scratch,wb) For i in
xrange(1000000) f.write(str(i)) f.close()
C include ltiostream.hgt include
ltfstreamgt using namespace std int main(int
argc, char argv) ofstream out
out.open("/tmp/scratch") for(int i 0 i lt
1000000 i) out ltlt i out.close()
7
Comparisons (contd)
  • 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 extent.
  • 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 operators

8
SOURCES
  • http//www.razorvine.net/python/PythonComparedToJa
    va
  • http//www.wikipedia.com/Python_(programming_langu
    age)
  • http//furryland.org/mikec/bench
  • http//www.python.org
Write a Comment
User Comments (0)
About PowerShow.com