cmpe202 01 research
DESCRIPTION
CMPE202-01 Research project. SJSU 2011TRANSCRIPT
Programming Language Overview
Copyright ©2011, Volodymyr Korshak
Outline
History review. Why and by whom was python created?
Programming philosophy. How is it different to any other language?
Code samples. "Hands on" experience. Usage and Possibilities.
History in Brief
History overview
Python was conceived in the late 1980s by Guido van Rossum as a successor to the ABC programming language capable of exception handling.
Python has twice been awarded as TIOBE Programming Language of the Year (2007, 2010), which is given to the language with the greatest growth in popularity over the course of the year (as measured by the TIOBE index).
Programming Philosophy
Programming philosophy
Python uses dynamic typing and a combination of reference counting and a cycle-detecting garbage collector for memory management.
Pseudo-code:
Programming philosophy
An important feature of Python is dynamic name resolution (late binding), which binds method and variable names during program execution.
Pseudo-code:
Programming philosophy
Designed to be highly extensible. New built-in modules can be easily written in C, C++ or Cython.
Most of widely used modules are included in the Standard Library.
"there should be one—and preferably only one—obvious way to do it"
Code should be "beautiful", "explicit" "simple" and “easily-readable”
Most famous modules PyGame - Principal wrapper of the SDL library.
PyQt - Bindings for the cross-platform Qt framework.
Python Imaging Library (PIL) - Supports many file formats, and provides powerful image processing and graphics capabilities.
Django - High-level web framework.
web2py - High-level framework for agile development.
And many, many other powerful libraries, frameworks and modules.
Code Samples
Code Samples: Layout
Python does not use { } to enclose blocks of code for if/loops/function etc.. Instead, Python uses the colon (:) and indentation/whitespace to group statements.
Code Samples: Slices
The "slice" syntax is a handy way to refer to sub-parts of sequences - typically strings and lists. The slice s[start:end] is the elements beginning at start and extending up to but not including end.
Code Samples: Lists
Python has a great built-in list type named "list". List literals are written within square brackets [ ].
Code Samples: For In
Python's “for” and “in” constructs are extremely useful, and the first use of them we'll see is with lists. The “for” construct - for var in list - is an easy way to look at each element in a list (or other collection).
Code Samples: List Methods
Common list methods:
Code Samples: Dicts
Python's efficient key/value hash table structure is called a "dict". The contents of a dict can be written as a series of key:value pairs within braces { }
Code Samples: Dicts
Common “dict” methods:
Where is it used?
Common Usage
Often used as a scripting language. In operating systems. In large companies and organizations.
Common Usage
Often used as a scripting language:
Python has been successfully embedded in a number of software products as a scripting language, including in finite element method software such as Abaqus, 3D animation packages such as Houdini, Maya, MotionBuilder, Softimage, Cinema 4D, BodyPaint 3D, modo and Blender and 2D imaging programs like GIMP, Inkscape, Scribus and Paint Shop Pro.
Common Usage
In operating systems:
It ships with most Linux distributions, NetBSD, OpenBSD and with Mac OS X and can be used from the terminal. A number of Linux distributions use installers written in Python: Ubuntu uses the Ubiquity installer, while Red Hat Linux and Fedora use the Anaconda installer. Gentoo Linux uses Python in its package management system, Portage and the standard tool to access it, emerge. Pardus uses it for administration and during system boot.
Common Usage
In large companies and organizations:
Among the users of Python are YouTube and the original BitTorrent client. Organizations that make use of Python include Google, Yahoo!, CERN, NASA, ILM, and ITA. Most of the Sugar software for the One Laptop per Child XO, now developed at Sugar Labs, is written in Python.
Features
Features: Speed and Power
Python is powerful... and fast:
Fans of Python use the phrase "batteries included" to describe the standard library, which covers everything from asynchronous processing to zip files. The language itself is a flexible powerhouse that can handle practically any problem domain.
Features: Easy and Open
Python is friendly... and easy to learn:
Python also comes with complete documentation, both integrated into the language and as separate web pages. Online tutorials target both the seasoned programmer and the newcomer. All are designed to make you productive quickly. The availability of first-rate books completes the learning package.
Python is Open:
The Python implementation is under an open source license that makes it freely usable and distributable, even for commercial use.
Features: Flexible
Python plays well with others:
For Java libraries, use Jython, an implementation of Python for the Java Virtual Machine.
For .NET, try IronPython , Microsoft's new implementation of Python for .NET.
If you find something that Python cannot do, or if you need the performance advantage of low-level code, you can write extension modules in C or C++, or wrap existing code with SWIG or Boost.Python. You can also go the opposite route and embed Python in your own application, providing your users with a language they'll enjoy using.
Features: Portable
Python runs everywhere:
Python is available for all major operating systems: Windows, Linux/Unix, OS/2, Mac, Amiga, among others. There are even versions that run on .NET, the Java virtual machine, and Nokia Series 60 cell phones. You'll be pleased to know that the same source code will run unchanged across all implementations.
Summary
Summary
Python has: very clear, readable syntax intuitive object orientation full modularity, supporting hierarchical packages exception-based error handling very high level dynamic data types extensive standard libraries and third party modules for
virtually every task embeddable within applications as a scripting interface
Credits
Materials used: Official web-site: http://www.python.org
Google-python-class: http://code.google.com/edu/
Wikipedia Python article: http://en.wikipedia.org/wiki/Python_(programming_language)
Copyright ©2011, Volodymyr Korshak