1 Outline 7.1 Introduction 7.2 Implementing a Time Abstract Data Type with a Class 7.3 Special Attributes 7.4Controlling Access to Attributes 7.4.1Get.

Slides:



Advertisements
Similar presentations
Agenda Definitions Evolution of Programming Languages and Personal Computers The C Language.
Advertisements

Object-Oriented Programming
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
1 Programming for Engineers in Python Autumn Lecture 5: Object Oriented Programming.
Introduction to Python John Alexis Guerra Gómez CMSC433 Spring 2010 University of Maryland.
Scripting Languages CS351 – Programming Paradigms.
ASP.NET Programming with C# and SQL Server First Edition
C++ fundamentals.
Python Introduction.
Guide to Programming with Python Chapter Nine Working with/Creating Modules.
Sydney Opera House. Week Three Agenda Administrative Issues Link of the week Review week two lab assignment This week’s expected outcomes Next lab assignment.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 35 – Python Outline 35.1 Introduction First Python Program Python Keywords 35.2 Basic.
Microsoft Visual Basic 2005: Reloaded Second Edition
1 Perl Perl basics Perl Elements Arrays and Hashes Control statements Operators OOP in Perl.
PHP TUTORIAL. HISTORY OF PHP  PHP as it's known today is actually the successor to a product named PHP/FI.  Created in 1994 by Rasmus Lerdorf, the very.
Python: An Introduction
Week Three Agenda Administrative Issues Link of the Week Review Week Two Information This Week’s Expected Outcomes Next Lab Assignment Break-Out Problems.
Python Modules An Introduction. Introduction A module is a file containing Python definitions and statements. The file name is the module name with the.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
GNU Compiler Collection (GCC) and GNU C compiler (gcc) tools used to compile programs in Linux.
Ch 1. A Python Q&A Session Spring Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
Chapter 13. Procedural programming vs OOP  Procedural programming focuses on accomplishing tasks (“verbs” are important).  Object-oriented programming.
Functions, Procedures, and Abstraction Dr. José M. Reyes Álamo.
By James Braunsberg. What are Modules? Modules are files containing Python definitions and statements (ex. name.py) A module’s definitions can be imported.
1 Introduction to Classes and Objects Chapter 3 Introduction to Classes and Objects Chapter 3.
C463 / B551 Artificial Intelligence Dana Vrajitoru Python.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Guide to Linux Installation and Administration, 2e1 Chapter 11 Using Advanced Administration Techniques.
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
Programming Perl in UNIX Course Number : CIT 370 Week 6 Prof. Daniel Chen.
OCR GCSE Computing © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 1: Introduction.
CS105 Computer Programming PYTHON (based on CS 11 Python track: lecture 1, CALTECH)
ECET – Dynamic Programming with Python Spring 2013 Lecture L1 – Introduction to Python Page 1 Welcome! This is Professor Jai P. Agrawal. I will walk.
TCL TK. Tcl/Tk C functions can become Tcl commands that are invoked interactively Tk = scriptable, portable user interface –Windows, X (Unix), MacOS,
Sydney Opera House. Week Three Agenda Administrative Issues Link of the week Use of the Virtual Machine Review week two lab assignment This week’s expected.
PHP vs. Python. Similarities are interpreted, high level languages with dynamic typing are Open Source are supported by large developer communities are.
 2008 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
1 Classes II Chapter 7 2 Introduction Continued study of –classes –data abstraction Prepare for operator overloading in next chapter Work with strings.
Modules. Modules Modules are the highest level program organization unit, usually correspond to source files and serve as libraries of tools. Each file.
Dept. of Animal Breeding and Genetics Programming basics & introduction to PERL Mats Pettersson.
LECTURE 2 Python Basics. MODULES So, we just put together our first real Python program. Let’s say we store this program in a file called fib.py. We have.
Ganga/Dirac Data Management meeting October 2003 Gennady Kuznetsov Production Manager Tools and Ganga (New Architecture)
Perl Ed Finegan. Overview of Pearl Perl is a high-level programming language written by Larry Wall. It derives from the C programming language and to.
Shell Scripting September 27, 2004 Class Meeting 6, Part II * Notes adapted by Lenwood Heath from previous work by other members of the CS faculty at Virginia.
PROGRAMMING USING PYTHON LANGUAGE ASSIGNMENT 1. INSTALLATION OF RASPBERRY NOOB First prepare the SD card provided in the kit by loading an Operating System.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
Presented By P.SRIVIDYA 085D1A0552 Programming Language.
Lecture III Syntax ● Statements ● Output ● Variables ● Conditions ● Loops ● List Comprehension ● Function Calls ● Modules.
Fundamentals of Programming I Overview of Programming
Python Programming Unit -1.
Introduction to Perl: Practical extraction and report language
CST 1101 Problem Solving Using Computers
Python’s Modules Noah Black.
Lecture 2 Python Basics.
Introduction Python is an interpreted, object-oriented and high-level programming language, which is different from a compiled one like C/C++/Java. Its.
Sydney Opera House.
Python’s Modules by E. Esin GOKGOZ.
Python Training in Chennai
Perl Modules.
Henning Schulzrinne Advanced Programming
Functions, Procedures, and Abstraction
Python Modules.
Functions, Procedures, and Abstraction
Python Basics. Topics Features How does Python work Basic Features I/O in Python Operators Control Statements Function/Scope of variables OOP Concepts.
Python Modules.
Presentation transcript:

1 Outline 7.1 Introduction 7.2 Implementing a Time Abstract Data Type with a Class 7.3 Special Attributes 7.4Controlling Access to Attributes 7.4.1Get and Set Methods 7.4.2Private Attributes 7.5 Using Default Arguments With Constructors 7.6 Destructors 7.7 Class Attributes 7.8 Composition: Object References as Members of Classes 7.9Data Abstraction and Information Hiding 7.10 Software Reusability

2 Python, short introduction CSC 667/867 San Francisco State Univ.

3 Abstract Python Tutorials at Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python's elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms. The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C). Python is also suitable as an extension language for customizable applications. For a description of standard objects and modules, see the Python Library Reference document. The Python Reference Manual gives a more formal definition of the language. Python Library ReferencePython Reference Manual

4 Features and Strength I You could write a Unix shell script or Windows batch files for some of these tasks, but shell scripts are best at moving around files and changing text data, not well-suited for GUI applications or games. You could write a C/C++/Java program, but it can take a lot of development time to get even a first-draft program. Python is simpler to use, available on Windows, MacOS X, and Unix operating systems, and will help you get the job done more quickly. Python is simple to use, but it is a real programming language, offering much more structure and support for large programs than shell scripts or batch files can offer.

5 Features and Strength II high-level data types built in, such as flexible arrays and dictionaries Because of its more general data types Python is applicable to a much larger problem domain than Awk or even Perl, yet many things are at least as easy in Python as in those languages. Built in modules -file I/O, system calls, sockets, and even interfaces to graphical user interface toolkits like Tk.

6 Features & Strength III Python enables programs to be written compactly and readably. –the high-level data types allow you to express complex operations in a single statement; –statement grouping is done by indentation instead of beginning and ending brackets; –no variable or argument declarations are necessary.

7 Control Flow – if statement >>> x = int(raw_input("Please enter an integer: ")) >>> if x < 0:... x = 0... print 'Negative changed to zero'... elif x == 0:... print 'Zero'... elif x == 1:... print 'Single'... else:... print 'More'...

8 Control Flow – for statement

9 More control statements

10 Defining Functions

11 Defining Function II There are more information to read about functions related to scoping, arguments, etc. Check “4.7 More on Defining Functions” from the tutorial

12 Data Structures

13

14

15

16 More data structures Tuples Sequences Sets Dictionaries So, where to look at? Check the tutorial!

17

18 Modules A module is a file containing Python definitions and statements. The file name is the module name with the suffix.py appended. If fibo.py contains fib() function and fib2() function, then user can invoke them using –Import fibo –fibo.fib() –fibo.fib2() Or –from fibo import fib, fib2 –fib() –fib2()

19 Modules The module Search Path using environment variable, PYTHONPATH –on Unix, this is usually.:/usr/local/lib/python ``Compiled'' Python files (for speeding up the modules) –.pyc files –.pyo files (optimized compilation is used)

20 Standard Modules Python Library Reference at

21 Packages Packages are a way of structuring Python's module namespace by using ``dotted module names''.

22 Packages When importing the package, Python searches through the directories on sys.path looking for the package subdirectory. The __init__.py files are required to make Python treat the directories as containing packages; Users of the package can import individual modules from the package, for example: –import Sound.Effects.echo –Sound.Effects.echo.echofilter(input, output, delay=0.7, atten=4) An alternative way of importing the submodule is: –from Sound.Effects import echo –from Sound.Effects import *

23 Classes

24

25 Standard Library of Python

26

27

28

29 Python CGI (1)

30 Python CGI (2)

31 Python CGI (3)