The Python Programming Language - PowerPoint PPT Presentation

About This Presentation
Title:

The Python Programming Language

Description:

Title: The Python Programming Language Author: John Myers Last modified by: Jeffrey Myers Created Date: 1/4/2002 10:03:04 PM Document presentation format – PowerPoint PPT presentation

Number of Views:75
Avg rating:3.0/5.0
Slides: 13
Provided by: JohnMy152
Learn more at: https://cs.rit.edu
Category:

less

Transcript and Presenter's Notes

Title: The Python Programming Language


1
The Python Programming Language
  • Jeff Myers

http//milly.rh.rit.edu/python/
Programming Language Concepts, 01/14/2002
2
Python Overview
  • Scripting Language
  • Object-Oriented
  • Portable
  • Powerful
  • Easy to learn and use
  • Mixes good features from Java, Perl and Scheme

3
Major Uses of Python
  • System Utilities
  • GUIs (Tkinter, gtk, Qt, Windows)
  • Internet Scripting
  • Embedded Scripting
  • Database Programming
  • Artificial Intelligence
  • Image Processing

4
History of Python
  • Created in 1990 by Guido van Rossum
  • Named after Monty Python
  • First public release in 1991
  • comp.lang.python founded in 1994
  • Open source from the start

5
Language Features
  • Object-Oriented
  • Interpreted
  • Interactive
  • Dynamic
  • Functional
  • Highly readable

6
Built-in Object Types
  • Numbers - 3.1415, 1234, 999L, 34j
  • Strings - 'spam', "guido's"
  • Lists - 1, 2, 'three', 4
  • Dictionaries - 'food''spam', 'taste''yum'
  • Tuples - (1, 'spam', 4, 'U')
  • Files - text  open ('eggs', 'r'). read()

7
Operators
  • Booleans and or not lt lt gt gt ! ltgt
  • Identity is, is not
  • Membership in, not in
  • Bitwise
  • No -- , etc.

8
String Operators
  • Concatenation
  • Repeat
  • Index stri
  • Slice strij
  • Length len( str )
  • String Formatting "a s parrot"  'dead
  • Iteration for char in str
  • Membership m in str

9
Common Statements
  • Assignment - curly, moe, larry  'good', 'bad', 'u
    gly'
  • Calls - stdout.write("spam, ham, toast\n")
  • Print - print 'The Killer', joke
  • If/elif/else - if "python" in text print text
  • For/else - for X in mylist print X
  • While/else - while 1 print 'hello'
  • Break, Continue - while 1 if not line break
  • Try/except/finally - try action() except print '
    action error'

10
Common Statements
  • Raise - raise endSearch, location
  • Import, From - import sys from sys import stdin
  • Def, Return - def f(a, b, c1, d) return abcd
  • Class - class subclass staticData  
  • Global - function() global X, Y X  'new'
  • Del - del datak del data ij del obj.attr
  • Exec - yexec "import"  modName in gdict, ldict
  • Assert - assert X gt Y

11
Samples
  • System Utility
  • Functional Programming
  • Object Oriented networking

12
References
  • Python homepage http//www.python.org/
  • Jython homepage http//www.jython.org/
  • Programming Python and Learning Python
    http//python.oreilly.com/
  • This presentation is available from
    http//milly.rh.rit.edu/python/
Write a Comment
User Comments (0)
About PowerShow.com