Transcript PYTHON

PYTHON




Mitch Martin
Josh Amick
Abdulla Al-nuaimi
Brad Gunnells
Points of Interest
Overview
 Language evolution
 Language concepts
 Examples of usage
 Comparison and Popularity
 Impact and Assessment

What is Python?






Interpreted, Interactive and Object-oriented
Remarkable power with clear syntax
Interfaces to system calls and libraries
Extensible in C or C++
Portable (Unix, Mac, MS-DOS, Windows, OS/2)
Incorporates: modules, exceptions, dynamic
typing, very high level dynamic data types, and
classes
Python name?



Looking for name that was short,
unique, and slightly mysterious
Guido van Rossum was reading “Monty
Python ’s Flying Circus” at the time
Decided to call new language PYTHON
History

Created by Guido van Rossum
Started during Christmas holidays
1989
 Spent year working on own time
 Success using it in Amoeba Project
 Prompted him to keep improving it

Problem Domain


Guido van Rossum needed a scripting
language like ABC that could access
Amoeba system calls.
He also realized it would need to be
extensible so it wouldn’t be specific to
the Amoeba Project.
Problem Domain cont.

ABC
Use of indentation for statement
grouping
 Very-high-level data types
 Implementation very different
 Lack of extensibility led to:

Problem Domain cont.
Had experience with Modula-2+
 Talked to designers of Modula-3
 Read Modula-3 report
 Origin of syntax and semantics
used for exception handling

Language Concepts

Dynamically Typed


No need for type declarations before use
Clean and Concise Syntax



No Braces or semicolons
Indentations define blocks -> Example:
if x == y:
No Switch Statement
...block


Use if...elif...elif...else
One Constructor per Class
elif x > y:
...block
else:
...block
Sample Code
class Student():
def __init__(self, argStudentName, argGPA = 0, argClass = "freshman"):
self.StudentName = argStudentName
self.GPA = argGPA
self.Class = argClass
...
Sample Code
Sample Code (cont.)
Python Compared to Other
Languages



Scripting language
High-Level
language
Syntax



Emphasizes
readability
Indentation
If, while, for
http://en.wikipedia.org/wiki/Image:Python_add5
_syntax.png
Comparison con't.

Free under GNU GPL

Object oriented



Very similar to Perl, Ruby, Scheme, Smalltalk & Tcl
Can work with other languages such as Java and
C/C++
Types – Variables



Duck – Latent typing
Does not enforce static typing
Strongly typed
Python Popularity



http://www.python.org/pics/pythonHi.gif
Relatively young
language – Created
in early 1990's
Tens of thousands of
users
NASA, AstraZeneca
and Honeywell,
Industrial Light and
Magic, Google, Yahoo
Usage
It can handle small and big projects.
 Actively used in industry and academia.
 It utilizes some of the largest projects
Such as:




Zope: application server
BitTorrent: file sharing
Google: used extensively
Future development


Python 3.0 (Python 3000)
New features:

moving map, filter and reduce out of the built-in namespace.

adding support for optional type declarations.



unifying the str/unicode types, and introducing a separate
mutable bytes type.
converting built-ins to returning iterators (instead of lists),
where appropriate.
removing backward-compatibility features like classic
classes, classic division, string exceptions, and implicit
relative imports.
Questions
Questions are guaranteed in life;
Answers aren’t
????
Bibliography



http://www.python.org/doc/faq/general/
http://en.wikipedia.org/wiki/Python_
programming_language
http://www.ibiblio.org/g2swap/byteofpython/r
ead/if-statement.html