Docsity

A Crash Course in Python, Study notes of Object Oriented Programming

Partial preview of the text

Download A Crash Course in Python and more Study notes Object Oriented Programming in PDF only on Docsity!

A Crash Course in Python^

A Crash Course in PythonBased onLearning PythonBy Mark Lutz & David Ascher, O'Reillyhttp://proquestcombo.safaribooksonline.com/book/programming/python/9780596805395Presented byCuauhtémoc Carbajal^ ITESM CEM

A Crash Course in Python^

Agenda^ „^ Why Python^ „^ Python References^ „^ Python Advantages^ „^ Python Toolkit^ „^ Getting Python^ „^ Running Python^ „^ Python Principles^ „^ Python Language and Examples

Why Python?

It’s Easy to Use

„^ High-level language

: Distinct from the low-level processor operations; closer to human language thanmachine language „ "Programming at the speed of thought" „ Increases productivity^ „^ Python programs three to five times shorter than Java^ „^ Python programs five to ten times shorter than C++ „ Normally, “Programming is like making fine furniture withan axe and a nail file.” „ Python makes it more like working with a table saw & alathe^ „^ You still have to learn how to use them, but they’re theright tools for the job

Python Is Easy to Use(continued)^ „^ Python Program^ print "Game Over!"^ „^ C++ Program^ #include int main(){ std::cout << "Game Over!" << std::endl;return 0;}

7

Python Is Object-Oriented^ „^ Object-oriented programming(OOP):^ Methodology that definesproblems in terms of objects that sendmessages to each other^ „^ In a game, a

Missile^ object could send a Ship object a message to^

Explode

„^ OOP not required, unlike Java and C#

Python Is a “Glue” Language^ „^ Can be integrated with other languages^ „^ C/C++^ „^ Java^ „^ Use existing code^ „^ Leverage strengths of other languages^ „^ Extra speed that C or C++ offers

Python Has a StrongCommunity^ „^ As an approachable language, hasapproachable community^ „^ Python Tutor mailing list^ „^ http://mail.python.org/mailman/listinfo/tutor^ „^ Perfect for beginners^ „^ No actual "tutors" or "students"

Python Is Free and OpenSource^ „^ Open source

: Publicly available; open

source software typically programmedby volunteers; anyone can use sourcecode without fee „ Can modify or even resell Python „ Embracing open-source ideals is part ofwhat makes Python successful

A Crash Course in Python^

Fastest Way to Learn^ „^ Study examples^ „^ Lay foundations without surprises^ „^ Note the exceptions to experience^ „^ Do quick pop quizzes^ „^ Practice what you have learned

A Crash Course in Python^

Python Advantages^ „^ Object-Oriented^ „^ Dynamic Type Checking makes it inherentlygeneric – C++ templates for free!^ „^ Free, as in Open Source free^ „^ Portable^ „^ Powerful language constructs / features^ „^ Powerful toolkit / library^ „^ Mixable with other languages^ „^ Easy to use & learn

How Python Is Used^ „^ System utilities^ „^ GUIs using Tkinter^ „^ Component integration^ „^ Rapid prototyping^ „^ Internet scripting^ „^ Database programming

Getting Python^ „^ On the Web:^ www.python.org

Running Python (2)^ „^ From platform specific shells^ „^ #!/usr/local/bin/python^ „^ print "Hello there"^ Or^ „^ #!/usr/bin/env python^ „^ print "Hello there"

Python defined as anenvironment variable

Running Python (3)^ „^ Embedded in another system^ „^ #include <Python.h>^ „^ //...^ „^ Py_Initialize();^ „^ PyRun_SimpleString("x=pfx+root+sfx");^ „^ //...^ „^ Platform-specific invocation^ „^ E.g., Double clicking

.py^ files