python for application integration and development

27
Copyright © Elitegroup Computer Systems. All Rights Reserved Page1 組內報告 Python for Application Integration and Development 胡崇偉 marr 2012/10/30 Python for Application Integration and Development

Upload: tsungwei-hu

Post on 15-Jan-2015

831 views

Category:

Technology


5 download

DESCRIPTION

Python Introduction in the Group Meeting on 2012/10/30.

TRANSCRIPT

Page 1: Python for Application Integration and Development

Copyright © Elitegroup Computer Systems. All Rights Reserved Page1

組內報告

Python for Application Integration and Development

胡崇偉 marr

2012/10/30

Python

for Application

Integration and Development

Page 2: Python for Application Integration and Development

組內報告 2012/10/30 2

Agenda

History of Python

Python Features

Python as Research Workbench

Python for Web Development

Python Community

Conclusion

Page 3: Python for Application Integration and Development

組內報告 2012/10/30 3

In the 70s,

Xerox PARC asked:

Can we have a computer on every desk?

Page 4: Python for Application Integration and Development

組內報告 2012/10/30 4

A follow-up Question:

What will happen if users can

program their own computer?

Page 5: Python for Application Integration and Development

組內報告 2012/10/30 5

History of Python

Guido van Rossum created Python when he was working at CWI (Centrum Wiskunde & Informatica) during 1989 - 1991

Page 6: Python for Application Integration and Development

組內報告 2012/10/30 6

Python Chronology

1989

1995

2001

2004

CP4E

1994

Programming as a Literacy

Research

CWI

comp.lang.python

CNRI

2009

Education

Commercial

Page 7: Python for Application Integration and Development

組內報告 2012/10/30 7

The Year When My Script Looks Like…

use CGI;

my $q = CGI->new();

say $q->header(), $q->start_html();

say "<h1>Parameters</h1>";

for my $param ($q->param()) {

my $safe_param = $q->escapeHTML($param);

say "<p><strong>$safe_param</strong>: ";

for my $value ($q->param($param)) {

say $q->escapeHTML($value);

}

say '</p>';

}

say $q->end_html();

Page 8: Python for Application Integration and Development

組內報告 2012/10/30 8

My Brain Just Hardly Fits Them…

Even Worse…

my $q%&*#@->{~(,)};

inconsistent coding style?

Page 9: Python for Application Integration and Development

組內報告 2012/10/30 9

Python Features: Easy to Learn

if ’smiths’ in RegisterList:

sendNote(‘VIP registered’)

elif ’doe’ not in RegisterList:

startPlan(‘B’)

else:

print len(RegisterList)

length() will return # of elements

Page 10: Python for Application Integration and Development

組內報告 2012/10/30 10

Python Features: Indentation

if ’smiths’ in RegisterList:

sendNote(‘VIP registered’)

elif ’doe’ not in RegisterList:

startPlan(‘B’)

else:

print(len(RegisterList))

Indentation with white spaces

Page 11: Python for Application Integration and Development

組內報告 2012/10/30 11

Readability counts

Programs are meant to be read by humans and only incidentally for computersto execute -- Donald Knuth

Page 12: Python for Application Integration and Development

組內報告 2012/10/30 12

The Zen of Python, by Tim Peters

There should be one –and preferably only one –obvious way to do it.

• Having one way to do it is an advantage.

Once the idioms are hardwired in your brain,

you’d have instant recognition.

Toward Pythonic Thinking

Page 13: Python for Application Integration and Development

組內報告 2012/10/30 13

Python as Research Workbench

Python makes it easy to balance high-level

programming with low-level optimization.

Python excels at gluing other languages.

Numerous libraries provide the needed

functionality for scientific.

Python incorporates documentation and

testing directly into the language itself.

Page 14: Python for Application Integration and Development

組內報告 2012/10/30 14

reStructuredText Example

.. math:: \Gamma(z) =\int_0^\infty x^{z-1}e^{-x}\,dx

Page 15: Python for Application Integration and Development

組內報告 2012/10/30 15

Research Libraries

Fortran to Python

interface generator

ctypes

Page 16: Python for Application Integration and Development

組內報告 2012/10/30 16

GIS and SQL Tools

ArcPy

PyPROJgeopy

Shapely

Fiona

Page 17: Python for Application Integration and Development

組內報告 2012/10/30 17

Python for Web Development

Common Ways to Have Your Web Sites:

• Building Them with Frameworks• Building Them with CMSes

You

are

here

Your

Website

here

Page 18: Python for Application Integration and Development

組內報告 2012/10/30 18

Plone, a Python based CMS

CMS = Contents Stored in DatabaseAdded/Edited by User/GroupManaged with WorkflowSearchable via Index/Catalog

Forms in Database

or simply…

Page 19: Python for Application Integration and Development

組內報告 2012/10/30 19

Form Elements

CMS = Contents Stored in DatabaseAdded/Edited by User/GroupManaged with WorkflowSearchable via Index/Catalog

Page 20: Python for Application Integration and Development

組內報告 2012/10/30 20

Dexterity Content Types

Page 21: Python for Application Integration and Development

組內報告 2012/10/30 21

Form Behaviors

CMS = Contents Stored in DatabaseAdded/Edited by User/GroupManaged with WorkflowSearchable via Index/Catalog

Page 22: Python for Application Integration and Development

組內報告 2012/10/30 22

Form Behaviors: Maps Enabled

Page 23: Python for Application Integration and Development

組內報告 2012/10/30 23

More Packages Needed? Python Packages are distributed as Eggs and

listed on http://pypi.python.org/

Page 24: Python for Application Integration and Development

組內報告 2012/10/30 24

Python Community

Page 25: Python for Application Integration and Development

組內報告 2012/10/30 25

The Python Paradox, by Paul Graham

• You could get smarter programmers to work

on a Python project than you could to work

on a Java project.

• If a company chooses to write its software in

a comparatively esoteric language, they'll be

able to hire better programmers, because

they'll attract only those who cared enough

to learn it.

• The language to learn, if you want to get a

good job, is a language that people don't

learn merely to get a job.

Page 26: Python for Application Integration and Development

組內報告 2012/10/30 26

Conclusion

Python serves well as the first language to

learn, even better as the glue when

working with other languages or tools.

It helps to improve team productivity.

Get more: Extending with C/C++ or

Embedding in Applications

Google Engineering Decision:

Python where we can, C++ where we must

Page 27: Python for Application Integration and Development

組內報告

Python Style Ending

if questions:

try:

answer()

except RuntimeError:

pass

else:

print(‘Thank You.’)