Top Banner
Ch 1. A Python Q&A Session Spring 2009
25

Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Jan 13, 2016

Download

Documents

Shon Harvey
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Ch 1. A Python Q&A Session

Spring 2009

Page 2: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Why do people use Python?

Software quality Developer productivity Program portability Support libraries Component integration

Page 3: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Why do people use Python?

Software quality Python is designed to be readable, and hence

reusable and maintainable The uniformity of Python code makes it easy to

understand, even if you didn’t write it Python is deep support for software reuse

mechanisms such as object-oriented programming (OOP)

Page 4: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Why do people use Python?

Developer productivity Python code is typically 1/3 to 1/5 the size of equivalent

C++ or JAVA code Less to type, less to debug, and less to maintain Python programs run immediately, without compile and

link steps of some other tools, further boosting programmer speed

Page 5: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Why do people use Python?

Program portability Most python programs run unchanged on all major

computer platforms Porting Python code between Linux and Windows, we just

need copy a script’s code between machines Offer multiple options for coding portable graphical user

interfaces, database access programs, web-based systems Even for operating system interfaces, are possibly portable

in Python

Page 6: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Why do people use Python?

Support libraries A large collection of prebuilt and portable functionality,

known as stand library Be extended with homegrown libraries and third-party

application support software Third-party domains offer tools for website construction,

numeric programming, serial port access, and game development

For example, NumPy, an extension almost equivalent to Matlab numeric programming system

Page 7: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Why do people use Python?

Component integration Python scripts can communicate with other parts of an

application by integration mechanisms Today, Python code can invoke C and C++ libraries, can

be called from C and C++, can integrate with Java components

Communicate over such as frameworks COM, .NET Interact over networks with interfaces like SOAP, XML,

CORBA

Page 8: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

What can I do with Python?

System programming Built-in interfaces to operating system services make it

ideal to write system administration tools and utilities Python programs can search files and directory trees,

launch other programs, do parallel processing

GUIs A standard object-oriented interface to the Tk GUI API,

Tkinter, allowing Python programs to implement portable GUIs

Other toolkits also can be used in Python

Page 9: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

What can I do with Python?

Internet scripting Come with standard internet modules to allow Python to

perform networking tasks A large collection of third-party tools available on the web

for doing Internet programming in Python

Database programming Interfaces to all commonly used relational databases

systems such as Sybase, Oracle, etc

Games, images, AI, XML and more

Page 10: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

What are Python’s Technical Strength

It’s OOIt’s freeIt’s PortableIt’s PowerfulIt’s Easy to useIt’s Easy to learn

Page 11: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

What is the Downside of Python?

Perhaps the only downside to Python is that the execution speed may not always as fast as compiled languages such as C and C++

Python is not compiled all the way down to binary machine code, it compiled to byte code instead

Page 12: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Who Uses Python Today? 2007, roughly 1 million users of Python around the world Google and Yahoo currently use Python in Internet service The YouTube video sharing service is largely writing in Python IBM use Python for hardware testing BitTorrent peer-to-peer file sharing system is a Python program Industrial Light and Magic use Python in the production of

movie animation JPMorgan chase apply Python for financial market forcasting NASA uses Python for scientific programming tasks For more details, visit www.python.org

Page 13: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Install Python

Links of Python download Windows installer Mac installer Python tutorial

Page 14: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Install Python

1. Click the installer

Page 15: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Install Python

2. Click Next

Page 16: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Install Python

3. Click Next

Page 17: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Install Python

4. Choose the installation path, click Next

Page 18: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Install Python

5. Click Install

Page 19: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Install Python

6. Click Finish, then we can open Python in Pythonwin IDE or interactive shell modes

Page 20: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

How do you run programs?

Three different methods Interactive Coding Files (such as NotePad, WordPad) Integrated Development Environment (IDE)

Page 21: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Hello World Program

Python program

Page 22: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

“Hello World” in C

C programmain()

{

printf("hello, World!\n");

}

Page 23: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

“Hello World” in Java

Java programclass helloworld

{

public static void main(String args[])

{

System.out.println("Hello World!");

}

}

Page 24: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Some more Python codes

6+9

print 6+9

print “6+9”

a=6+9

print a

a=6

b=9

a+b

Page 25: Ch 1. A Python Q&A Session Spring 2009. Why do people use Python? Software quality Developer productivity Program portability Support libraries Component.

Some more Python codes