Python Programming Language. Created in 1991 by Guido Van Rossum.

Slides:



Advertisements
Similar presentations
wwwcsif.cs.ucdavis.edu/~jacksoni
Advertisements

Python Whats in a name? Snake logos and mascot notwithstanding, its named after Monty Pythons Flying Circus Humor-impaired can safely.
Optional Static Typing Guido van Rossum (with Paul Prescod, Greg Stein, and the types-SIG)
A Crash Course Python. Python? Isn’t that a snake? Yes, but it is also a...
Spring, Hibernate and Web Services 13 th September 2014.
CS 4800 By Brandon Andrews.  Specifications  Goals  Applications  Design Steps  Testing.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
Vending Machine FSM Benjamin Welton 03/20/2010 CS 480.
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
Python Jordan Miller and Lauren Winkleman CS 311 Fall 2011.
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
Introduction to Python (for C++ programmers). Background Information History – created in December 1989 by Guido van Rossum Interpreted Dynamically-typed.
Struts 2.0 an Overview ( )
+ Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
AIT 616 Fall 2002 PHP. AIT 616 Fall 2002 PHP  Special scripting language used to dynamically generate web documents  Open source – Free!!!  Performs.
©2007 · Georges Merx and Ronald J. NormanSlide 1 Chapter 3 The Structure and Syntax of Java.
SB ScriptBasic Introduction to ScriptBasic There are more people writing programs in BASIC than the number of people capable programming.
Putting What We Learned Into Context – WSGI and Web Frameworks A290/A590, Fall /16/2014.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
Introduction to Java CSIS 3701: Advanced Object Oriented Programming.
Felipe Pollola Paulo Vitor. MVC (Model-View-Controller); About TurboGears; TurboGears Installation; Creating a Project; Starting a Project; Implementing.
Java Introduction to JNI Prepared by Humaira Siddiqui.
BLU-ICE and the Distributed Control System Constraints for Software Development Strategies Timothy M. McPhillips Stanford Synchrotron Radiation Laboratory.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
1 Cisco Unified Application Environment Developers Conference 2008© 2008 Cisco Systems, Inc. All rights reserved.Cisco Public Introduction to Etch Scott.
Applied Computing Technology Laboratory QuickStart C# Learning to Program in C# Amy Roberge & John Linehan November 7, 2005.
C463 / B551 Artificial Intelligence Dana Vrajitoru Python.
Getting started with Programming using IDE. JAVA JAVA IS A PROGRAMMING LANGUAGE AND A PLATFORM. IT CAN BE USED TO DELIVER AND RUN HIGHLY INTERACTIVE DYNAMIC.
Introduction to Python Origins Nature of Python Importance of Python Example.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are.
Programming Paradigms By Tyler Smith. Event Driven Event driven paradigm means that the program executes code in reaction to events. The limitation of.
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
C is a high level language (HLL)
 A readable, dynamic, pleasant,  flexible, fast and powerful language Introduction to Python.
PYTHON FOR HIGH PERFORMANCE COMPUTING. OUTLINE  Compiling for performance  Native ways for performance  Generator  Examples.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Basic Concepts for Python Web Development. What Does Make Python Different Batter Software QA Developer Productivity Advance Program Portability Support.
JavaScript Invented 1995 Steve, Tony & Sharon. A Scripting Language (A scripting language is a lightweight programming language that supports the writing.
Python Programming Language by Vasu Chetty. Origins of Python Created by: Guido van Rossum, a Dutch Programmer Created during: Christmas Break, 1989 Created.
Python Joseph Eckstrom, Benjamin Moore, Willis Kornegay.
CSE S. Tanimoto Java Introduction 1 Java A Programming Language for Web-based Computing.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
J2EE vs Python for web development David
Programming in Go(lang)
Top 8 Best Programming Languages To Learn
CST 1101 Problem Solving Using Computers
Alternate Pythons Boston Python Meetup, Presented by David Malcolm
Spark Presentation.
Internet and Java Foundations, Programming and Practice
Functional Programming with Java
Do you know this browser?...
JavaScript an introduction.
Introduction to Python
Introduction to Python
CS-0401 INTERMEDIATE PROGRAMMING USING JAVA
Google App Engine Ying Zou 01/24/2016.
Units with – James tedder
Units with – James tedder
.Net Framework Details Imran Rashid CTO at ManiWeber Technologies.
(Computer fundamental Lab)
Lecture 10: The Web Server Wednesday February 14, /10/2019
Tutorial 10: Programming with javascript
Chap 1. Getting Started Objectives
Python Basics. Topics Features How does Python work Basic Features I/O in Python Operators Control Statements Function/Scope of variables OOP Concepts.
Plug-In Architecture Pattern
Presentation transcript:

Python Programming Language

Created in 1991 by Guido Van Rossum

Python Programming Language General Purpose Language  Clean Syntax

Python Programming Language General Purpose Language  Clean Syntax  Easy to Learn

Python Programming Language General Purpose Language  Clean Syntax  Easy to Learn  Easy to Debug

Python Programming Language General Purpose Language  Clean Syntax  Easy to Learn  Easy to Debug  “Natural Feeling”

Python Programming Language General Purpose Language Interpreted

Python Programming Language General Purpose Language Interpreted  No Compilation Phase

Python Programming Language General Purpose Language Interpreted  No Compilation Phase  Multiplatform Integration

Python Programming Language General Purpose Language Interpreted  No Compilation Phase  Multiplatform Integration  Native Debugger

Python Programming Language General Purpose Language Interpreted Duck Typing

Python Programming Language General Purpose Language Interpreted Duck Typing  Override behaviours by creating methods

Python Programming Language General Purpose Language Interpreted Duck Typing  Override behaviours by creating methods  Implement operations by creating methodst

Python Programming Language General Purpose Language Interpreted Duck Typing  Override behaviours by creating methods  Implement operations by creating methods  All data is an object

Python Programming Language Objects are Python’s abstraction for data. All data in a Python program is represented by objects or by relations between objects. Every object has an identity, a type and a value.

Python Programming Language An object’s identity never changes once it has been created  The ‘is‘ operator compares the identity of two objects  The id() function returns an integer representing its identity

Python Programming Language An object’s identity never changes once it has been created  The ‘is‘ operator compares the identity of two objects  The id() function returns an integer representing its identity An object’s type is also unchangeable.  The type() function returns an object’s type (which is an object itself).

Python Programming Language General Purpose Language Interpreted Duck Typing Strongly Typed

Python Programming Language A Python programmer can write in any style they like, using design patterns borrowed from: Imperative Declarative Object Oriented functional programming The author is free let the problem guide the development of the solution.

Python Programming Language print('hello world') class Hello(object): def __init__(self, my_string): self.my_string = my_string def __call__(self, render_func): out_str = 'Hello %s' % self.my_string render_func(out_str) def print_string(string_to_print): print(string_to_print) myHelloWorldClass = Hello('world') myHelloWorldClass(print_string)

Functional Example Python addn = lambda n: lambda x: x + n Or def addN(n): def add_n(x): return x + n return add_n Java: public class OuterClass { // Inner class class AddN { AddN(int n) { _n = n; } int add(int v) { return _n + v; } private int _n; } public AddN createAddN(int var) { return new AddN(var); } LISP (define (addn n) (lambda (k) (+ n k)))

Modular Design The standard Python interpreter (CPython) is written in C89 It is designed with two-way interfacing in mind: Embedding C programs in Python Embedding Python programs in C

Modular Design An Example C Module #include static PyObject * spam_system(PyObject *self, PyObject *args) { const char *command; int sts; if (!PyArg_ParseTuple(args, "s", &command)) return NULL; sts = system(command); return Py_BuildValue("i", sts); } /********************************************************* ** import spam ** ** spam.system( ** ** 'find. -name "*.py" ** ** -exec grep -Hn "Flying Circus" {} \;') ** *********************************************************/

Cross Platform Execution The CPython interpreter can be built on most platforms with a standard C library including glibc and uclibc.

Cross Platform Execution Interpreters such as Jython and IronPython can be used to run a python interpreter on any Java or.NET VM respectively.

Python Is Good For Protyping

Python Is Good For Protyping Web Applications/SAS

Python Is Good For Protyping Web Applications/SAS Integration

Python Is Good For Protyping Web Applications/SAS Integration Transport Limited Applications

Python Is Good For Protyping Web Applications/SAS Integration Transport Limited Applications Indeterminate Requirements

Python Is Good For Protyping Web Applications/SAS Integration Transport Limited Applications Indeterminate requirements Short Relevence Lifetime

Python Is Good For Protyping Web Applications/SAS Integration Transport Limited Applications Indeterminate requirements Short Relevence Lifetime Porting Legacy Applications

Python Is Good For Protyping Web Applications/SAS Integration Transport Limited Applications Indeterminate requirements Short Relevence Lifetime Porting Legacy Applications Glue

Python is Not Good For Native Cryptography

Python is Not Good For Native Cryptography MILOR

Python is Not Good For Native Cryptography MILOR Highly Parallel Design

__Types__ None

__Types__ None NotImplemented

__Types__ None NotImplemented Boolean

__Types__ None NotImplemented Boolean Int/LongInt

__Types__ None NotImplemented Boolean Int/LongInt Float (which is really a double)

__Types__ None NotImplemented Boolean Int/LongInt Float (which is really a double) Complex (double +doubleJ)

__Types__ None NotImplemented Boolean Int/LongInt Float (which is really a double) Complex (double +doubleJ) Sequences...

__Types__ Sequences string unicode bytes tuple list set frozenset

__Types__ None NotImplemented Boolean Int/LongInt Float (which is really a double) Complex (double +doubleJ) Sequences... Mapping Types (dict)

__Types__ None NotImplemented Boolean Int/LongInt Float (which is really a double) Complex (double +doubleJ) Sequences... Mapping Types (dict) Functions and Methods

__Types__ None NotImplemented Boolean Int/LongInt Float (which is really a double) Complex (double +doubleJ) Sequences... Mapping Types (dict) Functions and Methods Generators

__Types__ None NotImplemented Boolean Int/LongInt Float (which is really a double) Complex (double +doubleJ) Sequences... Mapping Types (dict) Functions and Methods Generators Modules

__Types__ None NotImplemented Boolean Int/LongInt Float (which is really a double) Complex (double +doubleJ) Sequences... Mapping Types (dict) Functions and Methods Generators Modules File/Buffer

__Types__ None NotImplemented Boolean Int/LongInt Float (which is really a double) Complex (double +doubleJ) Sequences... Mapping Types (dict) Functions and Methods Generators Modules File/Buffer Type (metaclasses)

Special Duck Methods __abs__ __add__ __and__ __iter__ __getitem__ __iter__ __del__ __cmp__! __hash__ __lt__ For Example

Example Code class Foo: baz = 'monkey' def bar(self): self.printFunc(self.text) foo = Foo() foo.text = 'Hello World' def print_console_factory( filter_func=lambda a: a ): def print_console(text): print(filter_func(text)) return print_console foo.printFunc = print_console_factory() print_hello_world = foo.bar print_hello_world() >>> Hello World vowels = [ 'a', 'e', 'i', 'o', 'u' ] filter_vowels = lambda a: ''.join([ let for let in a if not let.lower() in vowels ]) foo.printFunc = print_console_factory(filter_vowels) print_hello_world() >>>Hll Wrld

Python Resources Python.org Documentation Python.org PEPs Ye Olde Cheese Shoppe

Alternate Implementation C API   Create C Modules  Execute Python within a C application  Interface via a C API

Alternate Implementation Jython   Native JVM Python interpreter  Full support for standard library  Other C Extensions may not be ported  Python extensions may rely on C extensions

Alternate Implementation PyPy   Python interpreter written in python  Framework interprets multiple languages  Highly extendable  Slow

Alternate Implementation Psyco   Actually a C module  Produces highly optimized C code from python bytecode  Excellent performance characteristics  Configurable

Alternate Implementation IronPython  ectName=IronPython  Native python interpreter (C#) for.NET  Full support for standard library  Many external modules have been ported  Porting modules is quite simple  Can integrate with.NET languages

Alternate Implementation PyJamas   Python interpreter for JavaScript  Cross browser fully supported  As lightweight as you'd think  JSON/JQuery may be a better option

Alternate Implementation ShedSkin   Produces C++ code from Python code  Excellent for prototyping  Some language features not supported  Implicit static typed code only

Alternate Implementation Cython   Embed C code in a python application  Excellent for use in profiling  Compiled at first runtime  Shared build env with python interpreter

Hosting Python mod_python  By far most common hosting mechanism   Apache2 specific  Interpreter embedded in webserver worker  Memory intensive  Fast

Hosting Python WSGI  Up and coming – for a good reason    Can embedded interpreter  Can run threaded standalong app server  Very fast and inexpensive  Sandboxing supported

Hosting Python FastCGI  Mature and stable  Requires no 3 rd party modules for most webservers  Fast and inexpensive  Sandboxing supported

Hosting Python CGI  Mature and stable  Supported on nearly all platforms  Very flexible in terms of hosting requirements  Slow

Web Frameworks Django   Active user community  Well documented  Currently under active development  Extensive meta and mock classes  Clean layer separation

Web Frameworks Django  Data Layer  Business Logic  Control Layer  Presentation Layer  Not just for the web

Web Frameworks Turbogears – CherryPy   Persistent app server  Javascript integration via mochikit  Flexible DB backend via SQLObject

Web Frameworks Pylons - Paste   Multiple DB Backends supported  Multiple templating languages pluggable  Multiple request dispatching  HTTP oriented  Forward compatible  MVC Type layer separation

Web Frameworks Zope   Web Application Framework  Highly Web Oriented  Not lightweight  Highly Featureful  ZDB Data store backend

Web Frameworks Zope   Web Application Framework  Highly Web Oriented  Not lightweight  Highly Featureful  ZDB Data store backend