SlideShare a Scribd company logo
1 
"Perl is worse than Python because people wanted it worse." 
- Larry Wall (14 Oct 1998 15:46:10 -0700, Perl Users mailing list) 
"Life is better without braces." and "Python fits your brain." 
- Bruce Eckel, author of Thinking in C++ , Thinking in Java 
"Python is an excellent language [and makes] sensible compromises." 
- Peter Norvig (Google), author of Artificial Intelligence 
What is Python? 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
An Introduction 
+Wesley Chun, Principal 
CyberWeb Consulting 
cyberwebconsulting.com 
Python 
is 
Fun! 
(I've used it at lots of places!) 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
2 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
I'm here to give 
you an idea of 
what it is! 
(I've written a lot about it!) 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
3 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
I've taught it at 
lots of places! 
(companies, schools, etc.) 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
4 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
About You 
zSW/HW Engineer/Lead 
zSys Admin/IS/IT/Ops 
zWeb/Flash Developer 
zQA/Testing/Automation 
zScientist/Mathematician 
zToolsmith, Hobbyist 
zRelease Engineer/SCM 
zArtist/Designer/UE/UI/UX 
zStudent/Teacher 
zFamiliar with… 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
zJava, C, C++, C# 
zPHP, JavaScript 
z(Visual) Basic 
zPerl, Tcl, Ruby 
zany other high-level 
language… 
zDjango, Pyramid, web2py, Flask, Fabric, Plone, Trac, Mailman, App Engine
5 
Why are you here? You… 
z Have heard good word-of-mouth 
z Came via Django, App Engine, Plone, etc. 
z Discovered Google, Yahoo!, et al. use it 
z Already know but want formal training 
z Were forced by your boss 
z Safari Books Online: Top 5, Apr 2009 
1. iPhone 
2. Java 
3. Python 
4. C# 
5. PHP 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
source: TIOBE Programming Community Index for April 2009 (tiobe.com) 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
6 
For New Programmers 
zProgramming should be easy enough 
to teach like reading & writing (CP4E) 
zWhat you need to be good 
zSome math background 
zAlgebra, physics (problem solving) 
zBuddy who already is a developer 
zEven better if they know Python 
zTinkerer, curious, itch-scratcher 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
About this Talk 
zGoal: Introduce as much Python as one can in an hour 
zSeminar Topics 
zLanguage Introduction 
zPython Object Types 
zLoops and Conditionals 
zFiles, Functions, Modules 
zObject-Oriented Programming 
zErrors and Exception Handling 
zMiscellaneous 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
7 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
Background 
zGuido van Rossum: began late '89, released early '91 
zInherits from ABC, Modula, C/C++, LISP, ALGOL, Perl, Java, etc. 
zNamed after Monty Python, not the snake ☺ 
zCross-platform (Mac, PC, *ix; only need a C compiler) 
zAlternate implementations: Jython, IronPython, Stackless, PyPy, etc. 
zPhilosophy, Concepts and Syntax 
zRobust Enough "batteries included" to get job done 
zSimple Clean, easy-to-read, easier than VB?!? 
zModular Plug-n-play, use only what you need 
zExtensible Can extend language to meet your needs 
zIntuitive "Python fits your brain." 
zOOP Object-oriented when you need it (not req'd) 
z"Pythonic" "There's only one way to do it…." 
Why (not) Python? 
zAdvantages 
zDisadvantages? 
ÎGenerally slower than 
compiled languages 
ÎObscure syntax? Naaah! 
ÎTyping requires discipline 
ÎSome idiosyncrasies 
and required idioms 
ÎMay not have your feature 
ÎMemory management 
ÎNo marketing force… 
mostly word-of-mouth 
ÎNo world domination… yet! 
ÎSimple syntax 
ÎRapid development 
ÎHigh-level data structures 
ÎObject-oriented 
ÎException handling 
ÎFunctional programming 
ÎMemory management 
ÎExtensible (C/C++/Java) 
ÎMany libraries: NW, DB, 
GUI, MT, XML/JSON/CSV, 
RE, OS/FS, Math, Web; 
plus 3rd-party 
ÎCommunity 
www.tiobe.com/index.php/ 
content/paperinfo/tpci 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
8 
Built for Non-Programmers 
zEducational language syntax 
zScratch (Tynker, Blockly, App Inventor) , Alice, Python, HTML 
zWorks well for school-aged children 
zSyntax, memory mgmt, data structures, OOP… 
zObstacles to learning concepts, deters interest 
zPython: retention, morale, understanding 
zProbably the "best" 1st language 
zWhat about professional developers? 
zC/C++, Java, PHP, Python, Ruby, JavaScript 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
Some Newbie Resources 
zPublished Books 
zHello World! Computer Programming for Kids & Other Beginners 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
(Sande, Sande: 2009) 
zInvent Your Own Computer Games with Python (Sweigart: 2010) 
zPython Programming for the Absolute Beginner (Dawson: 2010) 
zLearning with Python: How to Think Like a Computer Scientist 
(Downey, Elkner, Meyers: 2002) 
zOnline Books, Tutorials, Environments, etc. 
zHow to Think Like a Computer Scientist (Downey, Elkner, Meyers) 
zLearning to Program (Gauld) 
zLiveWires Python course 
zA Byte of Python (Swaroop) 
zInstant Hacking: Learning to Program with Python (Hetland) 
zSnake Wrangling for Kids (Briggs) 
zComputer Programming is Fun! (Handy) 
zKarel the Robot clones: Guido van Robot, RUR-PLE
9 
Interactive Interpreter 
zRun Python interactive interpreter from default IDE: IDLE 
To exit: Ctrl-D in IDLE or *ix 
cmd line; or Ctrl-Z in DOS 
zOr do it from the cmd-line or DOS command shell 
$ python # or C:> python 
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) 
[GCC 4.2.1 (Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> 
>>> print 'Hello World!' 
Hello World! 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
What You Just Saw 
z>>> ← this is the Python prompt 
zEnter any Python command after it 
zUse print to display output to users 
zUse print() in Python 3 
zTo exit interactive interpreter 
zCtrl-D from IDLE or *ix command-line 
zCtrl-Z from a DOS/command shell 
zInteractive Interpreter: testing, debugging, hacking, 
experimenting regardless of IDE use or otherwise 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
10 
Getting Python 
zPOSIX (Mac OS, *nix): already installed 
zPC, source, and other downloads 
zpython.org or corepython.com 
zOther IDEs 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
zSPE (pictured) 
zPythonWin 
zEclipse & PyDev 
zPyCharm/intelliJ 
zKomodo 
zWingIDE 
zIPython Notebook 
Online Python interpreters/shells 
• Can't or don't wish to install Python locally? 
• Run Python from just a web browser 
•ideone.com 
•colabv6.dan.co.jp/lleval.html 
•doc.pyschools.com/console 
•repl.it/languages/Python 
•skulpt.org (pure JS implementation; allows turtle) 
•pythonwebconsole.thomnichols.org 
•shell.appspot.com (Google App Engine + libraries) 
•codepad.org 
•lotrepls.appspot.com 
•datamech.com/devan/trypython/trypython.py 
• Most are 2.x, some (top pair) do 3.x 
• Some support multiple languages 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
11 
Online learning systems 
•Learn & code Python with these learning environments 
•LearnStreet (login optional) •learnstreet.com/lessons/study/python 
•Codecademy •codecademy.com/tracks/python 
•PySchools •pyschools.com 
•Online Python Tutor •pythontutor.com 
•LearnPython.org •learnpython.org 
•CodingBat (login optional) •codingbat.com/python 
•SingPath (login required) •singpath.com 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
•Online Python course 
•Udacity •udacity.com/course/cs101 
•Coursera •coursera.org/course/interactivepython •coursera.org/course/programming1 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
Hello World! 
„ Using print statement or function 
print 'Hello World!' # 2.x 
print('Hello World!') # 3.x 
„ Or for 3.x compatibility & "futureproofing:" 
from __future__ import print_function 
# works in both 2.x and 3.x 
print('Hello World!')
12 
Common Beginner Gotchas 
zCode delimited by indentation not braces { } 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
if x > 10: 
return "'x' is greater than 10" 
else: 
return "'x' is less than 10" 
zNo extraneous characters ( ; , $, …) 
zNo switch-case, private class members, ++/--, 
static type checking, anonymous blocks, etc. 
zFreaky-looking floats*: 1.1 → 1.10000000001 
zSingle element tuple needs comma: (None,) 
z 3.x-only: print() & true div: 1/2 == 0.5 
Variables and Expressions 
>>> 4 + 6 * 5 # math ops like other langs 
34 
>>> a = 4 + 6 ** 2 # no declaration needed 
>>> a 
40 
>>> a = 'Python' # auto garbage collection 
>>> b = 'is cool' 
>>> a + b # ops can be overloaded 
'Pythonis cool' 
>>> a = a + ' ' + b # reassignment no problem 
>>> a 
'Python is cool' 
>>> # useful interactive tool 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
13 
„ Allocated on assignment: Dynamic/Duck Typing 
„ Memory Management: Reference Counting 
„ Variables not declared: type inferred on assignment 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
Objects 
zStandard Data Types 
zNumbers (3-8) 
zStrings (2-3) 
zLists 
zTuples 
zDictionaries 
zSets (2) 
zOther Types 
zNone 
zFiles, Modules 
zFunctions/Methods 
zIterators/Generators 
zType/Classes 
zmiscellaneous 
Standard Operators 
+ - * / // % ** 
<< >> & | ^ ~ 
== >= <= < > != 
is is not and or not 
•Grouping expressions in ( ) okay as usual 
•** means exponentiation, % means modulus/remainder 
•/ means true division in 3.x and classic division in 2.x 
•Use // for standard integer floor division 
•Assignment using single equals ( = ) 
•Augmented assignment +=, -=, *=, etc. (no ++ though) 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
14 
Numbers 
zintegers (no size limit except for VM) 
z-680, 0o237, 0xDEADBEEF, 64-0x41, 0b110 
zfloating point real numbers (IEEE-754 C double) 
z-97.65, -3.14159, -6e2, 0.1 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
zcomplex numbers 
zComposed of real and imaginary parts (floats) 
z11.65-5.55J, 4J, -3e2+8.73J, 0.1-2.3e4J 
zAlso long, bool, Decimal, Fraction, Rational, etc. 
zOther modules: math, cmath, random, operator 
Strings ' ' " " ''' ''' 
zStrings are sequences of characters (single/double quotes) 
zNo 'char' type… strings of length 1 
zFormat operator ( % ) for printf()-like functionality 
zFlexible alternative: string format() method (new in 2.6) 
zTriple quotes allow special characters like newlines 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
>>> x = 'Python' 
>>> x * 2 
'PythonPython' 
>>> x *= 2 
>>> x 
'PythonPython' 
>>> x[-1] 
'n' 
>>> x[-4:-1] 
'tho' 
>>> 'ton' in x 
False 
>>> '%s is number %d' % (x[:6], 1) 
'Python is number 1' 
>>> '{0} is #{1}'.format(x[:6], 1) 
'Python is #1' 
>>> 
>>> hi = '''hi 
there''' 
>>> hi 
'hinthere' 
>>> print(hi) 
hi 
there
15 
Lists [ ] and Tuples ( ) 
zLists: ordered sequences of arbitrary objects 
zMutable (values can be updated) 
zCan have lists of lists, i.e., multidimensional indexing 
zTuples similar but immutable (no value updates allowed) 
z"List comprehensions" allows for quick logical building of lists 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
zCommon list methods: 
zlist.sort() # "sort" list contents in-place 
zlist.reverse() # reverse a list in-place 
zlist.append() # append item to list 
zlist.insert() # insert items in list 
zlist.remove/pop() # remove item(s) from list 
zlist.extend() # extend a list with another one 
zlist.count() # return number of item occurrences 
zlist.index() # lowest index where item is found 
List Operations 
>>> m = ['Core', 'Programming', 9, 2006] 
>>> m.append('Prentice Hall') 
>>> m.insert(1, 'Pytho') 
>>> m 
['Core', 'Pytho', 'Programming', 9, 2006, 'Prentice Hall'] 
>>> m[1] = 'Python' 
>>> m.pop(3) 
9 
>>> m 
['Core', 'Python', 'Programming', 2006, 'Prentice Hall'] 
>>> m.sort() 
>>> m 
[2006, 'Core', 'Prentice Hall', 'Programming', 'Python'] 
>>> [i*3 for i in range(20) if i % 2 == 0] 
[0, 6, 12, 18, 24, 30, 36, 42, 48, 54] 
>>> f = open('myFile', 'r') 
>>> data = [line.strip() for line in f] 
>>> f.close() 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
16 
Dictionaries { } 
zDictionaries (sets like dicts but only hashed keys) 
zMutable, resizable hash tables 
zMappings of keys to values 
zKeys: scalar (usually strings or numbers) 
zValues: arbitrary Python objects 
zNo key collisions allowed 
zSimilar to Java HashMap, JS Object, Perl hash/associative array 
zMost commonly-used methods: 
zd.items() # iterable: key-value pairs 
zd.get() # return key's value (or default) 
zd.setdefault() # return key's value, set if nec. 
zd.pop() # remove item from d and return 
zd.update() # merge contents from another dict 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
Dictionary Operations 
>>> d = {'title': 'Core Python Programming', 'year': 2006} 
>>> d 
{'year': 2006, 'title': 'Core Python Programming'} 
>>> 'year' in d 
True 
>>> 'pub' in d 
False 
>>> d.get('pub', 'N/A') # KeyError if d['pub'] 
'N/A' 
>>> d['pub'] = 'Prentice Hall' 
>>> d.get('pub', 'N/A') # no KeyError for d['pub'] now 
'Prentice Hall' 
>>> for eachKey in d: 
print(eachKey, ':', d[eachKey]) 
year : 2006 
pub : Prentice Hall 
title : Core Python Programming 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
17 
if-elif-else Statements 
zConditional statements are what you expect 
# prompt, get, and check user input 
data = raw_input("Enter 'y' or 'n': ") 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
if data[0] == 'y': 
print("You typed 'y'.") # 'y' key 
elif data[0] == 'n': 
print("You typed 'n'.") # 'n' key 
else: 
print('invalid key!') # other key 
zTernary Operator (aka Conditional Expressions: C ? T : F) 
smaller = x if x < y else y # T if C else F 
Loops 
zPython while loops are same as in other languages 
zfor more like shell foreach & used ~90% over while 
zIterate over elements rather than counting/conditional 
zrange() helps "simulate" traditional for loops 
zLoop "friends" break & continue also here 
aList = [123, 'xyz', 45.67] 
>>> for eachItem in aList: 
... print(eachItem) 
123 
xyz 
45.67 
>>> for i in range(0, 3, 1): # think "for (i=0; i<3; i+=1)" 
... print(i) 
0 
1 
2 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
>>> i = 0 
>>> while i < 3: 
... print(i) 
... i += 1 
0 
1 
2
18 
Files 
z Open a file and get back a file object 
f = open(name, mode) # mode: r/r+, w, a, U 
z Most commonly-used file methods 
f.close() Close file 
f.read() Read bytes from file 
f.write() Write a string to file 
z Display text file example: 
f = open('data.txt', 'r') 
for line in f: 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
print(line.rstrip()) 
f.close() 
z… or, alternatively (2.6+) 
with open('data.txt', 'r') as f: 
for line in f: 
print(line, end='') 
Introducing Functions 
zFunction declaration syntax and example 
def func_name([v1,…, vN=dv,… *args, **kwargs): 
"documentation string" 
function_body 
def addYor10(x, y=10): # 'y' has default value 
"adds 'x' and 'y'; latter defaults to 10" 
return x + y 
zFunctions heterogenous (untyped) 
zDefault values & variable arguments supported 
zCan return 0, 1, or more objects 
zPython returns None if no return value provided 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
19 
Importing Modules & Attributes 
zImporting modules or packages using import statement 
import module_name 
import string 
num = string.atoi('123') 
zImporting module attributes using from-import statement 
zNames brought into (global) variable namespace 
from module_name import module_element 
from string import atoi 
num = atoi('123') 
zPackages: allow for organizing modules using the file system 
zUse int()though… 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
Standard Library Sampler (“B.I.”) 
Module Name(s) Description 
sys System data, processing, and functionality 
os and os.path Operating and file system interface 
re, csv, json, xml Text processing 
time, datetime, calendar Date and time constants and functions 
socket, SocketServer Socket interface & server classes (TCP, UDP) 
sqlite3 API for SQLite databases 
subprocess External process management 
email, {smtp,pop,imap}lib Email processing 
Tkinter Python/Tk GUI toolkit interface 
threading, multiprocessing High-level threads/multiprocess APIs 
pickle, cPickle, shelve Serialize Python objects 
{c,}math, random, fractions,… Various math/numberic processing 
gzip, bz2, zipfile, tarfile Data compression and archive files 
{ftp,url,http,*}lib Various Internet client libraries 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
20 
Programmer Tools 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
„ Debugger 
„ pdb 
„ Profilers 
„ profile 
„ hotshot 
„ cProfile 
„ Tracer/Tracker 
„ trace 
„ Logger 
„ logging 
„ Timer 
„ timeit 
„ Help/Documentation 
„ pydoc 
„ Testing 
„ unittest 
„ doctest 
„ (external) nose 
„ (external) py.test 
„ Testing tools taxonomy 
goo.gl/Fpz0Z 
Object-Oriented Programming 
z"Constructor"/Initializer is __init__(), "self" is "this" 
zClass instantiation via function interface (rather than "new") 
zInstance attrs, multiple inheritance; no overloading nor private 
class MyClass(object): 
... def __init__(self, data=2): 
... self.info = data 
... def times(self, x): 
... return "%d * %d is %d" % ( 
... self.info, x, self.info * x) 
>>> 
>>> inst = MyClass(21) 
>>> inst.info 
21 
>>> print inst.times(3) 
21 * 3 is 63 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
21 
Exceptions and try-except 
zException handling via try-except statement 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
try: 
# statements to monitor 
except ExceptionName as e: 
# code to exec if ExceptionName occurs 
try: 
f = open('data.txt', 'r') 
except IOError as e: 
print("Can't open file:", e) 
return False # or sys.exit(1), etc. 
zThrow exceptions with raise; there is also a finally 
Python 2 vs. Python 3 
„ The What and the Why 
„ Fix early design flaws 
„ Some new features, many small improvements 
„ Plan: develop (remainder of) 2.x and 3.x together 
„ Provide transition tools (2to3, 2.6+, -Q, -3) 
„ Key Updates (no major syntax changes) 
„ print, exec changed to functions 
„ True division: 1/2 == 0.5 
„ Performance (more iterators, fewer lists) 
„ Consolidation/unification (integers, classes) 
„ Strings: Unicode default; bytes/bytearray types 
„ Intro to Python 3 article FYI 
„ informit.com/articles/article.aspx?p=1328795 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
22 
Where do you go from here? 
•The tip of the iceberg… 
zSystem Administration scripting tools and automation 
zNetworked/Internet Client-Server systems 
zGraphical User Interface (GUI) design and development 
zWeb frameworks and rich Internet applications (RIA) 
zScientific/numeric/mathematics-centric development 
zDatabase programming, Object-Relational Mappers (ORMs) 
zXML, JSON, CSV and other forms of text processing 
zJava with Jython; .NET/Mono with IronPython; COM, MFC 
zGraphics/imaging/multimedia/visual art processing 
zMultithreaded and higher-performance applications 
zEmbedded system design (hardware as well as Python) 
zQA/Testing automated test tools, suites, and frameworks 
zRapid application prototyping (all application areas) 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
Additional Resources 
zBooks for programmers (more @ goo.gl/i4u0R) 
zQuick Python Book (2010) 
zPython Fundamentals LiveLessons DVD (Chun, 2009) 
zCore Python Programming (2006 [2009]) 
zDive into Python (2009, 2004) 
zBeginning Python: From Novice to Professional (2008) 
zPython Cookbook (2013, 2005) 
zPython Standard Library by Example (2011) 
zPython Essential Reference (2009) & Python in a Nutshell (2006) 
zSome online resources 
zPython Quick Reference Guide rgruet.free.fr#QuickRef 
zPython Conferences worldwide www.pycon.org 
zCore Python Programming corepython.com 
zMailing list/newsgroup groups.google.com/group/comp.lang.python 
zPython Docs (+ FAQ, tutorial,…) docs.python.org 
zExternal 3rd-party/ repo python.org/pypi 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved.
23 
The Zen of Python (or import this by Tim Peters) 
1. Beautiful is better than ugly. 
2. Explicit is better than implicit. 
3. Simple is better than complex. 
4. Complex is better than complicated. 
5. Flat is better than nested. 
6. Sparse is better than dense. 
7. Readability counts. 
8. Special cases aren't special enough to break the rules. 
9. Although practicality beats purity. 
10. Errors should never pass silently. 
11. Unless explicitly silenced. 
12. In the face of ambiguity, refuse the temptation to guess. 
13. There should be one — and preferably only one — obvious way to do it. 
14. Although that way may not be obvious at first unless you're Dutch. 
15. Now is better than never. 
16. Although never is often better than right now. 
17. If the implementation is hard to explain, it's a bad idea. 
18. If the implementation is easy to explain, it may be a good idea. 
19. Namespaces are one honking great idea — let's do more of those! 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
Thank you! Questions? 
(c) 1998-2015 CyberWeb Consulting. 
All rights reserved. 
# Google+ 
# Twitter 
+Wesley Chun 
@wescpy 
wescpy @gmail # e-mail 
corepython.com # books 
cyberwebconsulting.com # training 
wescpy.blogspot.com # Python blog 
wesc.livejournal.com # personal blog

More Related Content

What's hot

Python and its Applications
Python and its ApplicationsPython and its Applications
Python and its Applications
Abhijeet Singh
 
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEWPYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
EditorIJAERD
 
Tensorflow 2.0 and Coral Edge TPU
Tensorflow 2.0 and Coral Edge TPU Tensorflow 2.0 and Coral Edge TPU
Tensorflow 2.0 and Coral Edge TPU
Andrés Leonardo Martinez Ortiz
 
Python Tutorial | Python Tutorial for Beginners | Python Training | Edureka
Python Tutorial | Python Tutorial for Beginners | Python Training | EdurekaPython Tutorial | Python Tutorial for Beginners | Python Training | Edureka
Python Tutorial | Python Tutorial for Beginners | Python Training | Edureka
Edureka!
 
Python presentation by Monu Sharma
Python presentation by Monu SharmaPython presentation by Monu Sharma
Python presentation by Monu Sharma
Mayank Sharma
 
Writing Fast Code (JP) - PyCon JP 2015
Writing Fast Code (JP) - PyCon JP 2015Writing Fast Code (JP) - PyCon JP 2015
Writing Fast Code (JP) - PyCon JP 2015
Younggun Kim
 
Lets learn Python !
Lets learn Python !Lets learn Python !
Lets learn Python !
Kiran Gangadharan
 
Why learn python in 2017?
Why learn python in 2017?Why learn python in 2017?
Why learn python in 2017?
Karolis Ramanauskas
 
Python for the Mobile and Web
Python for the Mobile and WebPython for the Mobile and Web
Python for the Mobile and Web
Derek Kiong
 
Python unit1
Python unit1Python unit1
Learn Python Programming | Python Programming - Step by Step | Python for Beg...
Learn Python Programming | Python Programming - Step by Step | Python for Beg...Learn Python Programming | Python Programming - Step by Step | Python for Beg...
Learn Python Programming | Python Programming - Step by Step | Python for Beg...
Edureka!
 
Why Python is better for Data Science
Why Python is better for Data ScienceWhy Python is better for Data Science
Why Python is better for Data Science
Ícaro Medeiros
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners
Sujith Kumar
 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1Kanchilug
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Rajesh Rajamani
 
Python Programming - XIII. GUI Programming
Python Programming - XIII. GUI ProgrammingPython Programming - XIII. GUI Programming
Python Programming - XIII. GUI ProgrammingRanel Padon
 
Understanding PyPy - PyConEs 14
Understanding PyPy - PyConEs 14Understanding PyPy - PyConEs 14
Understanding PyPy - PyConEs 14
fcofdezc
 
Python
PythonPython

What's hot (19)

Python and its Applications
Python and its ApplicationsPython and its Applications
Python and its Applications
 
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEWPYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
 
Tensorflow 2.0 and Coral Edge TPU
Tensorflow 2.0 and Coral Edge TPU Tensorflow 2.0 and Coral Edge TPU
Tensorflow 2.0 and Coral Edge TPU
 
Python Tutorial | Python Tutorial for Beginners | Python Training | Edureka
Python Tutorial | Python Tutorial for Beginners | Python Training | EdurekaPython Tutorial | Python Tutorial for Beginners | Python Training | Edureka
Python Tutorial | Python Tutorial for Beginners | Python Training | Edureka
 
Python presentation by Monu Sharma
Python presentation by Monu SharmaPython presentation by Monu Sharma
Python presentation by Monu Sharma
 
Writing Fast Code (JP) - PyCon JP 2015
Writing Fast Code (JP) - PyCon JP 2015Writing Fast Code (JP) - PyCon JP 2015
Writing Fast Code (JP) - PyCon JP 2015
 
Lets learn Python !
Lets learn Python !Lets learn Python !
Lets learn Python !
 
Why learn python in 2017?
Why learn python in 2017?Why learn python in 2017?
Why learn python in 2017?
 
Python for the Mobile and Web
Python for the Mobile and WebPython for the Mobile and Web
Python for the Mobile and Web
 
Python unit1
Python unit1Python unit1
Python unit1
 
Learn Python Programming | Python Programming - Step by Step | Python for Beg...
Learn Python Programming | Python Programming - Step by Step | Python for Beg...Learn Python Programming | Python Programming - Step by Step | Python for Beg...
Learn Python Programming | Python Programming - Step by Step | Python for Beg...
 
Python tutorial
Python tutorialPython tutorial
Python tutorial
 
Why Python is better for Data Science
Why Python is better for Data ScienceWhy Python is better for Data Science
Why Python is better for Data Science
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners
 
Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Python Programming - XIII. GUI Programming
Python Programming - XIII. GUI ProgrammingPython Programming - XIII. GUI Programming
Python Programming - XIII. GUI Programming
 
Understanding PyPy - PyConEs 14
Understanding PyPy - PyConEs 14Understanding PyPy - PyConEs 14
Understanding PyPy - PyConEs 14
 
Python
PythonPython
Python
 

Similar to What is Python? (Silicon Valley CodeCamp 2014)

What is Python?
What is Python?What is Python?
What is Python?
wesley chun
 
Python in 15 minutes
Python in 15 minutesPython in 15 minutes
Python in 15 minutes
Rodolfo Carvalho
 
Using SWIG to Control, Prototype, and Debug C Programs with Python
Using SWIG to Control, Prototype, and Debug C Programs with PythonUsing SWIG to Control, Prototype, and Debug C Programs with Python
Using SWIG to Control, Prototype, and Debug C Programs with Python
David Beazley (Dabeaz LLC)
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
lemonchoos
 
POWER OF PYTHON PROGRAMMING LANGUAGE
POWER OF PYTHON PROGRAMMING LANGUAGE POWER OF PYTHON PROGRAMMING LANGUAGE
POWER OF PYTHON PROGRAMMING LANGUAGE
teachersduniya.com
 
Python 101 For The Net Developer
Python 101 For The Net DeveloperPython 101 For The Net Developer
Python 101 For The Net Developer
Sarah Dutkiewicz
 
Python for Science and Engineering: a presentation to A*STAR and the Singapor...
Python for Science and Engineering: a presentation to A*STAR and the Singapor...Python for Science and Engineering: a presentation to A*STAR and the Singapor...
Python for Science and Engineering: a presentation to A*STAR and the Singapor...
pythoncharmers
 
Python on a chip
Python on a chipPython on a chip
Python on a chip
stoggi
 
Py4 inf 01-intro
Py4 inf 01-introPy4 inf 01-intro
Py4 inf 01-intro
Ishaq Ali
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
michaelaaron25322
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
TIB Academy
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
gabriellekuruvilla
 
Python Programming Draft PPT.pptx
Python Programming Draft PPT.pptxPython Programming Draft PPT.pptx
Python Programming Draft PPT.pptx
LakshmiNarayanaReddy48
 
Learn python
Learn pythonLearn python
Learn python
Kracekumar Ramaraju
 
Pythonlearn-01-Intro.pptx
Pythonlearn-01-Intro.pptxPythonlearn-01-Intro.pptx
Pythonlearn-01-Intro.pptx
MrHackerxD
 
py4inf-01-intro.ppt
py4inf-01-intro.pptpy4inf-01-intro.ppt
py4inf-01-intro.ppt
RosemeireArgentiniDe1
 
Beginning Python Programming
Beginning Python ProgrammingBeginning Python Programming
Beginning Python Programming
St. Petersburg College
 
Python_final_print_batch_II_vision_academy.pdf
Python_final_print_batch_II_vision_academy.pdfPython_final_print_batch_II_vision_academy.pdf
Python_final_print_batch_II_vision_academy.pdf
bhagyashri686896
 
Python_final_print_batch_II_vision_academy (1).pdf
Python_final_print_batch_II_vision_academy (1).pdfPython_final_print_batch_II_vision_academy (1).pdf
Python_final_print_batch_II_vision_academy (1).pdf
rupaliakhute
 

Similar to What is Python? (Silicon Valley CodeCamp 2014) (20)

What is Python?
What is Python?What is Python?
What is Python?
 
Python in 15 minutes
Python in 15 minutesPython in 15 minutes
Python in 15 minutes
 
Using SWIG to Control, Prototype, and Debug C Programs with Python
Using SWIG to Control, Prototype, and Debug C Programs with PythonUsing SWIG to Control, Prototype, and Debug C Programs with Python
Using SWIG to Control, Prototype, and Debug C Programs with Python
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
 
POWER OF PYTHON PROGRAMMING LANGUAGE
POWER OF PYTHON PROGRAMMING LANGUAGE POWER OF PYTHON PROGRAMMING LANGUAGE
POWER OF PYTHON PROGRAMMING LANGUAGE
 
Python 101 For The Net Developer
Python 101 For The Net DeveloperPython 101 For The Net Developer
Python 101 For The Net Developer
 
Python for Science and Engineering: a presentation to A*STAR and the Singapor...
Python for Science and Engineering: a presentation to A*STAR and the Singapor...Python for Science and Engineering: a presentation to A*STAR and the Singapor...
Python for Science and Engineering: a presentation to A*STAR and the Singapor...
 
Python on a chip
Python on a chipPython on a chip
Python on a chip
 
Py4 inf 01-intro
Py4 inf 01-introPy4 inf 01-intro
Py4 inf 01-intro
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
 
Python
PythonPython
Python
 
Python Programming Draft PPT.pptx
Python Programming Draft PPT.pptxPython Programming Draft PPT.pptx
Python Programming Draft PPT.pptx
 
Learn python
Learn pythonLearn python
Learn python
 
Pythonlearn-01-Intro.pptx
Pythonlearn-01-Intro.pptxPythonlearn-01-Intro.pptx
Pythonlearn-01-Intro.pptx
 
py4inf-01-intro.ppt
py4inf-01-intro.pptpy4inf-01-intro.ppt
py4inf-01-intro.ppt
 
Beginning Python Programming
Beginning Python ProgrammingBeginning Python Programming
Beginning Python Programming
 
Python_final_print_batch_II_vision_academy.pdf
Python_final_print_batch_II_vision_academy.pdfPython_final_print_batch_II_vision_academy.pdf
Python_final_print_batch_II_vision_academy.pdf
 
Python_final_print_batch_II_vision_academy (1).pdf
Python_final_print_batch_II_vision_academy (1).pdfPython_final_print_batch_II_vision_academy (1).pdf
Python_final_print_batch_II_vision_academy (1).pdf
 

More from wesley chun

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
wesley chun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
wesley chun
 
Easy path to machine learning (2023-2024)
Easy path to machine learning (2023-2024)Easy path to machine learning (2023-2024)
Easy path to machine learning (2023-2024)
wesley chun
 
Powerful Google developer tools for immediate impact! (2023-24 B)
Powerful Google developer tools for immediate impact! (2023-24 B)Powerful Google developer tools for immediate impact! (2023-24 B)
Powerful Google developer tools for immediate impact! (2023-24 B)
wesley chun
 
Exploring Google APIs with Python
Exploring Google APIs with PythonExploring Google APIs with Python
Exploring Google APIs with Python
wesley chun
 
Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)
wesley chun
 
Powerful Google developer tools for immediate impact! (2023-24 A)
Powerful Google developer tools for immediate impact! (2023-24 A)Powerful Google developer tools for immediate impact! (2023-24 A)
Powerful Google developer tools for immediate impact! (2023-24 A)
wesley chun
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
wesley chun
 
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
Exploring Google APIs 102: Cloud vs. non-GCP Google APIsExploring Google APIs 102: Cloud vs. non-GCP Google APIs
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
wesley chun
 
Serverless Computing with Python
Serverless Computing with PythonServerless Computing with Python
Serverless Computing with Python
wesley chun
 
Easy path to machine learning (2022)
Easy path to machine learning (2022)Easy path to machine learning (2022)
Easy path to machine learning (2022)
wesley chun
 
Google... more than just a cloud
Google... more than just a cloudGoogle... more than just a cloud
Google... more than just a cloud
wesley chun
 
Accessing Google Cloud APIs
Accessing Google Cloud APIsAccessing Google Cloud APIs
Accessing Google Cloud APIs
wesley chun
 
Serverless computing with Google Cloud
Serverless computing with Google CloudServerless computing with Google Cloud
Serverless computing with Google Cloud
wesley chun
 
Serverless Computing with Google Cloud
Serverless Computing with Google CloudServerless Computing with Google Cloud
Serverless Computing with Google Cloud
wesley chun
 
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud RunDesigning flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
wesley chun
 
Image archive, analysis & report generation with Google Cloud
Image archive, analysis & report generation with Google CloudImage archive, analysis & report generation with Google Cloud
Image archive, analysis & report generation with Google Cloud
wesley chun
 
Easy path to machine learning (Spring 2021)
Easy path to machine learning (Spring 2021)Easy path to machine learning (Spring 2021)
Easy path to machine learning (Spring 2021)
wesley chun
 
Exploring Google APIs with Python
Exploring Google APIs with PythonExploring Google APIs with Python
Exploring Google APIs with Python
wesley chun
 
Serverless Computing with Google Cloud
Serverless Computing with Google CloudServerless Computing with Google Cloud
Serverless Computing with Google Cloud
wesley chun
 

More from wesley chun (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Easy path to machine learning (2023-2024)
Easy path to machine learning (2023-2024)Easy path to machine learning (2023-2024)
Easy path to machine learning (2023-2024)
 
Powerful Google developer tools for immediate impact! (2023-24 B)
Powerful Google developer tools for immediate impact! (2023-24 B)Powerful Google developer tools for immediate impact! (2023-24 B)
Powerful Google developer tools for immediate impact! (2023-24 B)
 
Exploring Google APIs with Python
Exploring Google APIs with PythonExploring Google APIs with Python
Exploring Google APIs with Python
 
Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)
 
Powerful Google developer tools for immediate impact! (2023-24 A)
Powerful Google developer tools for immediate impact! (2023-24 A)Powerful Google developer tools for immediate impact! (2023-24 A)
Powerful Google developer tools for immediate impact! (2023-24 A)
 
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...Build an AI/ML-driven image archive processing workflow: Image archive, analy...
Build an AI/ML-driven image archive processing workflow: Image archive, analy...
 
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
Exploring Google APIs 102: Cloud vs. non-GCP Google APIsExploring Google APIs 102: Cloud vs. non-GCP Google APIs
Exploring Google APIs 102: Cloud vs. non-GCP Google APIs
 
Serverless Computing with Python
Serverless Computing with PythonServerless Computing with Python
Serverless Computing with Python
 
Easy path to machine learning (2022)
Easy path to machine learning (2022)Easy path to machine learning (2022)
Easy path to machine learning (2022)
 
Google... more than just a cloud
Google... more than just a cloudGoogle... more than just a cloud
Google... more than just a cloud
 
Accessing Google Cloud APIs
Accessing Google Cloud APIsAccessing Google Cloud APIs
Accessing Google Cloud APIs
 
Serverless computing with Google Cloud
Serverless computing with Google CloudServerless computing with Google Cloud
Serverless computing with Google Cloud
 
Serverless Computing with Google Cloud
Serverless Computing with Google CloudServerless Computing with Google Cloud
Serverless Computing with Google Cloud
 
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud RunDesigning flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
 
Image archive, analysis & report generation with Google Cloud
Image archive, analysis & report generation with Google CloudImage archive, analysis & report generation with Google Cloud
Image archive, analysis & report generation with Google Cloud
 
Easy path to machine learning (Spring 2021)
Easy path to machine learning (Spring 2021)Easy path to machine learning (Spring 2021)
Easy path to machine learning (Spring 2021)
 
Exploring Google APIs with Python
Exploring Google APIs with PythonExploring Google APIs with Python
Exploring Google APIs with Python
 
Serverless Computing with Google Cloud
Serverless Computing with Google CloudServerless Computing with Google Cloud
Serverless Computing with Google Cloud
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 

What is Python? (Silicon Valley CodeCamp 2014)

  • 1. 1 "Perl is worse than Python because people wanted it worse." - Larry Wall (14 Oct 1998 15:46:10 -0700, Perl Users mailing list) "Life is better without braces." and "Python fits your brain." - Bruce Eckel, author of Thinking in C++ , Thinking in Java "Python is an excellent language [and makes] sensible compromises." - Peter Norvig (Google), author of Artificial Intelligence What is Python? (c) 1998-2015 CyberWeb Consulting. All rights reserved. An Introduction +Wesley Chun, Principal CyberWeb Consulting cyberwebconsulting.com Python is Fun! (I've used it at lots of places!) (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 2. 2 (c) 1998-2015 CyberWeb Consulting. All rights reserved. I'm here to give you an idea of what it is! (I've written a lot about it!) (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 3. 3 (c) 1998-2015 CyberWeb Consulting. All rights reserved. I've taught it at lots of places! (companies, schools, etc.) (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 4. 4 (c) 1998-2015 CyberWeb Consulting. All rights reserved. About You zSW/HW Engineer/Lead zSys Admin/IS/IT/Ops zWeb/Flash Developer zQA/Testing/Automation zScientist/Mathematician zToolsmith, Hobbyist zRelease Engineer/SCM zArtist/Designer/UE/UI/UX zStudent/Teacher zFamiliar with… (c) 1998-2015 CyberWeb Consulting. All rights reserved. zJava, C, C++, C# zPHP, JavaScript z(Visual) Basic zPerl, Tcl, Ruby zany other high-level language… zDjango, Pyramid, web2py, Flask, Fabric, Plone, Trac, Mailman, App Engine
  • 5. 5 Why are you here? You… z Have heard good word-of-mouth z Came via Django, App Engine, Plone, etc. z Discovered Google, Yahoo!, et al. use it z Already know but want formal training z Were forced by your boss z Safari Books Online: Top 5, Apr 2009 1. iPhone 2. Java 3. Python 4. C# 5. PHP (c) 1998-2015 CyberWeb Consulting. All rights reserved. source: TIOBE Programming Community Index for April 2009 (tiobe.com) (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 6. 6 For New Programmers zProgramming should be easy enough to teach like reading & writing (CP4E) zWhat you need to be good zSome math background zAlgebra, physics (problem solving) zBuddy who already is a developer zEven better if they know Python zTinkerer, curious, itch-scratcher (c) 1998-2015 CyberWeb Consulting. All rights reserved. About this Talk zGoal: Introduce as much Python as one can in an hour zSeminar Topics zLanguage Introduction zPython Object Types zLoops and Conditionals zFiles, Functions, Modules zObject-Oriented Programming zErrors and Exception Handling zMiscellaneous (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 7. 7 (c) 1998-2015 CyberWeb Consulting. All rights reserved. Background zGuido van Rossum: began late '89, released early '91 zInherits from ABC, Modula, C/C++, LISP, ALGOL, Perl, Java, etc. zNamed after Monty Python, not the snake ☺ zCross-platform (Mac, PC, *ix; only need a C compiler) zAlternate implementations: Jython, IronPython, Stackless, PyPy, etc. zPhilosophy, Concepts and Syntax zRobust Enough "batteries included" to get job done zSimple Clean, easy-to-read, easier than VB?!? zModular Plug-n-play, use only what you need zExtensible Can extend language to meet your needs zIntuitive "Python fits your brain." zOOP Object-oriented when you need it (not req'd) z"Pythonic" "There's only one way to do it…." Why (not) Python? zAdvantages zDisadvantages? ÎGenerally slower than compiled languages ÎObscure syntax? Naaah! ÎTyping requires discipline ÎSome idiosyncrasies and required idioms ÎMay not have your feature ÎMemory management ÎNo marketing force… mostly word-of-mouth ÎNo world domination… yet! ÎSimple syntax ÎRapid development ÎHigh-level data structures ÎObject-oriented ÎException handling ÎFunctional programming ÎMemory management ÎExtensible (C/C++/Java) ÎMany libraries: NW, DB, GUI, MT, XML/JSON/CSV, RE, OS/FS, Math, Web; plus 3rd-party ÎCommunity www.tiobe.com/index.php/ content/paperinfo/tpci (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 8. 8 Built for Non-Programmers zEducational language syntax zScratch (Tynker, Blockly, App Inventor) , Alice, Python, HTML zWorks well for school-aged children zSyntax, memory mgmt, data structures, OOP… zObstacles to learning concepts, deters interest zPython: retention, morale, understanding zProbably the "best" 1st language zWhat about professional developers? zC/C++, Java, PHP, Python, Ruby, JavaScript (c) 1998-2015 CyberWeb Consulting. All rights reserved. Some Newbie Resources zPublished Books zHello World! Computer Programming for Kids & Other Beginners (c) 1998-2015 CyberWeb Consulting. All rights reserved. (Sande, Sande: 2009) zInvent Your Own Computer Games with Python (Sweigart: 2010) zPython Programming for the Absolute Beginner (Dawson: 2010) zLearning with Python: How to Think Like a Computer Scientist (Downey, Elkner, Meyers: 2002) zOnline Books, Tutorials, Environments, etc. zHow to Think Like a Computer Scientist (Downey, Elkner, Meyers) zLearning to Program (Gauld) zLiveWires Python course zA Byte of Python (Swaroop) zInstant Hacking: Learning to Program with Python (Hetland) zSnake Wrangling for Kids (Briggs) zComputer Programming is Fun! (Handy) zKarel the Robot clones: Guido van Robot, RUR-PLE
  • 9. 9 Interactive Interpreter zRun Python interactive interpreter from default IDE: IDLE To exit: Ctrl-D in IDLE or *ix cmd line; or Ctrl-Z in DOS zOr do it from the cmd-line or DOS command shell $ python # or C:> python Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) [GCC 4.2.1 (Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> >>> print 'Hello World!' Hello World! (c) 1998-2015 CyberWeb Consulting. All rights reserved. What You Just Saw z>>> ← this is the Python prompt zEnter any Python command after it zUse print to display output to users zUse print() in Python 3 zTo exit interactive interpreter zCtrl-D from IDLE or *ix command-line zCtrl-Z from a DOS/command shell zInteractive Interpreter: testing, debugging, hacking, experimenting regardless of IDE use or otherwise (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 10. 10 Getting Python zPOSIX (Mac OS, *nix): already installed zPC, source, and other downloads zpython.org or corepython.com zOther IDEs (c) 1998-2015 CyberWeb Consulting. All rights reserved. zSPE (pictured) zPythonWin zEclipse & PyDev zPyCharm/intelliJ zKomodo zWingIDE zIPython Notebook Online Python interpreters/shells • Can't or don't wish to install Python locally? • Run Python from just a web browser •ideone.com •colabv6.dan.co.jp/lleval.html •doc.pyschools.com/console •repl.it/languages/Python •skulpt.org (pure JS implementation; allows turtle) •pythonwebconsole.thomnichols.org •shell.appspot.com (Google App Engine + libraries) •codepad.org •lotrepls.appspot.com •datamech.com/devan/trypython/trypython.py • Most are 2.x, some (top pair) do 3.x • Some support multiple languages (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 11. 11 Online learning systems •Learn & code Python with these learning environments •LearnStreet (login optional) •learnstreet.com/lessons/study/python •Codecademy •codecademy.com/tracks/python •PySchools •pyschools.com •Online Python Tutor •pythontutor.com •LearnPython.org •learnpython.org •CodingBat (login optional) •codingbat.com/python •SingPath (login required) •singpath.com (c) 1998-2015 CyberWeb Consulting. All rights reserved. •Online Python course •Udacity •udacity.com/course/cs101 •Coursera •coursera.org/course/interactivepython •coursera.org/course/programming1 (c) 1998-2015 CyberWeb Consulting. All rights reserved. Hello World! „ Using print statement or function print 'Hello World!' # 2.x print('Hello World!') # 3.x „ Or for 3.x compatibility & "futureproofing:" from __future__ import print_function # works in both 2.x and 3.x print('Hello World!')
  • 12. 12 Common Beginner Gotchas zCode delimited by indentation not braces { } (c) 1998-2015 CyberWeb Consulting. All rights reserved. if x > 10: return "'x' is greater than 10" else: return "'x' is less than 10" zNo extraneous characters ( ; , $, …) zNo switch-case, private class members, ++/--, static type checking, anonymous blocks, etc. zFreaky-looking floats*: 1.1 → 1.10000000001 zSingle element tuple needs comma: (None,) z 3.x-only: print() & true div: 1/2 == 0.5 Variables and Expressions >>> 4 + 6 * 5 # math ops like other langs 34 >>> a = 4 + 6 ** 2 # no declaration needed >>> a 40 >>> a = 'Python' # auto garbage collection >>> b = 'is cool' >>> a + b # ops can be overloaded 'Pythonis cool' >>> a = a + ' ' + b # reassignment no problem >>> a 'Python is cool' >>> # useful interactive tool (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 13. 13 „ Allocated on assignment: Dynamic/Duck Typing „ Memory Management: Reference Counting „ Variables not declared: type inferred on assignment (c) 1998-2015 CyberWeb Consulting. All rights reserved. Objects zStandard Data Types zNumbers (3-8) zStrings (2-3) zLists zTuples zDictionaries zSets (2) zOther Types zNone zFiles, Modules zFunctions/Methods zIterators/Generators zType/Classes zmiscellaneous Standard Operators + - * / // % ** << >> & | ^ ~ == >= <= < > != is is not and or not •Grouping expressions in ( ) okay as usual •** means exponentiation, % means modulus/remainder •/ means true division in 3.x and classic division in 2.x •Use // for standard integer floor division •Assignment using single equals ( = ) •Augmented assignment +=, -=, *=, etc. (no ++ though) (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 14. 14 Numbers zintegers (no size limit except for VM) z-680, 0o237, 0xDEADBEEF, 64-0x41, 0b110 zfloating point real numbers (IEEE-754 C double) z-97.65, -3.14159, -6e2, 0.1 (c) 1998-2015 CyberWeb Consulting. All rights reserved. zcomplex numbers zComposed of real and imaginary parts (floats) z11.65-5.55J, 4J, -3e2+8.73J, 0.1-2.3e4J zAlso long, bool, Decimal, Fraction, Rational, etc. zOther modules: math, cmath, random, operator Strings ' ' " " ''' ''' zStrings are sequences of characters (single/double quotes) zNo 'char' type… strings of length 1 zFormat operator ( % ) for printf()-like functionality zFlexible alternative: string format() method (new in 2.6) zTriple quotes allow special characters like newlines (c) 1998-2015 CyberWeb Consulting. All rights reserved. >>> x = 'Python' >>> x * 2 'PythonPython' >>> x *= 2 >>> x 'PythonPython' >>> x[-1] 'n' >>> x[-4:-1] 'tho' >>> 'ton' in x False >>> '%s is number %d' % (x[:6], 1) 'Python is number 1' >>> '{0} is #{1}'.format(x[:6], 1) 'Python is #1' >>> >>> hi = '''hi there''' >>> hi 'hinthere' >>> print(hi) hi there
  • 15. 15 Lists [ ] and Tuples ( ) zLists: ordered sequences of arbitrary objects zMutable (values can be updated) zCan have lists of lists, i.e., multidimensional indexing zTuples similar but immutable (no value updates allowed) z"List comprehensions" allows for quick logical building of lists (c) 1998-2015 CyberWeb Consulting. All rights reserved. zCommon list methods: zlist.sort() # "sort" list contents in-place zlist.reverse() # reverse a list in-place zlist.append() # append item to list zlist.insert() # insert items in list zlist.remove/pop() # remove item(s) from list zlist.extend() # extend a list with another one zlist.count() # return number of item occurrences zlist.index() # lowest index where item is found List Operations >>> m = ['Core', 'Programming', 9, 2006] >>> m.append('Prentice Hall') >>> m.insert(1, 'Pytho') >>> m ['Core', 'Pytho', 'Programming', 9, 2006, 'Prentice Hall'] >>> m[1] = 'Python' >>> m.pop(3) 9 >>> m ['Core', 'Python', 'Programming', 2006, 'Prentice Hall'] >>> m.sort() >>> m [2006, 'Core', 'Prentice Hall', 'Programming', 'Python'] >>> [i*3 for i in range(20) if i % 2 == 0] [0, 6, 12, 18, 24, 30, 36, 42, 48, 54] >>> f = open('myFile', 'r') >>> data = [line.strip() for line in f] >>> f.close() (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 16. 16 Dictionaries { } zDictionaries (sets like dicts but only hashed keys) zMutable, resizable hash tables zMappings of keys to values zKeys: scalar (usually strings or numbers) zValues: arbitrary Python objects zNo key collisions allowed zSimilar to Java HashMap, JS Object, Perl hash/associative array zMost commonly-used methods: zd.items() # iterable: key-value pairs zd.get() # return key's value (or default) zd.setdefault() # return key's value, set if nec. zd.pop() # remove item from d and return zd.update() # merge contents from another dict (c) 1998-2015 CyberWeb Consulting. All rights reserved. Dictionary Operations >>> d = {'title': 'Core Python Programming', 'year': 2006} >>> d {'year': 2006, 'title': 'Core Python Programming'} >>> 'year' in d True >>> 'pub' in d False >>> d.get('pub', 'N/A') # KeyError if d['pub'] 'N/A' >>> d['pub'] = 'Prentice Hall' >>> d.get('pub', 'N/A') # no KeyError for d['pub'] now 'Prentice Hall' >>> for eachKey in d: print(eachKey, ':', d[eachKey]) year : 2006 pub : Prentice Hall title : Core Python Programming (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 17. 17 if-elif-else Statements zConditional statements are what you expect # prompt, get, and check user input data = raw_input("Enter 'y' or 'n': ") (c) 1998-2015 CyberWeb Consulting. All rights reserved. if data[0] == 'y': print("You typed 'y'.") # 'y' key elif data[0] == 'n': print("You typed 'n'.") # 'n' key else: print('invalid key!') # other key zTernary Operator (aka Conditional Expressions: C ? T : F) smaller = x if x < y else y # T if C else F Loops zPython while loops are same as in other languages zfor more like shell foreach & used ~90% over while zIterate over elements rather than counting/conditional zrange() helps "simulate" traditional for loops zLoop "friends" break & continue also here aList = [123, 'xyz', 45.67] >>> for eachItem in aList: ... print(eachItem) 123 xyz 45.67 >>> for i in range(0, 3, 1): # think "for (i=0; i<3; i+=1)" ... print(i) 0 1 2 (c) 1998-2015 CyberWeb Consulting. All rights reserved. >>> i = 0 >>> while i < 3: ... print(i) ... i += 1 0 1 2
  • 18. 18 Files z Open a file and get back a file object f = open(name, mode) # mode: r/r+, w, a, U z Most commonly-used file methods f.close() Close file f.read() Read bytes from file f.write() Write a string to file z Display text file example: f = open('data.txt', 'r') for line in f: (c) 1998-2015 CyberWeb Consulting. All rights reserved. print(line.rstrip()) f.close() z… or, alternatively (2.6+) with open('data.txt', 'r') as f: for line in f: print(line, end='') Introducing Functions zFunction declaration syntax and example def func_name([v1,…, vN=dv,… *args, **kwargs): "documentation string" function_body def addYor10(x, y=10): # 'y' has default value "adds 'x' and 'y'; latter defaults to 10" return x + y zFunctions heterogenous (untyped) zDefault values & variable arguments supported zCan return 0, 1, or more objects zPython returns None if no return value provided (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 19. 19 Importing Modules & Attributes zImporting modules or packages using import statement import module_name import string num = string.atoi('123') zImporting module attributes using from-import statement zNames brought into (global) variable namespace from module_name import module_element from string import atoi num = atoi('123') zPackages: allow for organizing modules using the file system zUse int()though… (c) 1998-2015 CyberWeb Consulting. All rights reserved. Standard Library Sampler (“B.I.”) Module Name(s) Description sys System data, processing, and functionality os and os.path Operating and file system interface re, csv, json, xml Text processing time, datetime, calendar Date and time constants and functions socket, SocketServer Socket interface & server classes (TCP, UDP) sqlite3 API for SQLite databases subprocess External process management email, {smtp,pop,imap}lib Email processing Tkinter Python/Tk GUI toolkit interface threading, multiprocessing High-level threads/multiprocess APIs pickle, cPickle, shelve Serialize Python objects {c,}math, random, fractions,… Various math/numberic processing gzip, bz2, zipfile, tarfile Data compression and archive files {ftp,url,http,*}lib Various Internet client libraries (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 20. 20 Programmer Tools (c) 1998-2015 CyberWeb Consulting. All rights reserved. „ Debugger „ pdb „ Profilers „ profile „ hotshot „ cProfile „ Tracer/Tracker „ trace „ Logger „ logging „ Timer „ timeit „ Help/Documentation „ pydoc „ Testing „ unittest „ doctest „ (external) nose „ (external) py.test „ Testing tools taxonomy goo.gl/Fpz0Z Object-Oriented Programming z"Constructor"/Initializer is __init__(), "self" is "this" zClass instantiation via function interface (rather than "new") zInstance attrs, multiple inheritance; no overloading nor private class MyClass(object): ... def __init__(self, data=2): ... self.info = data ... def times(self, x): ... return "%d * %d is %d" % ( ... self.info, x, self.info * x) >>> >>> inst = MyClass(21) >>> inst.info 21 >>> print inst.times(3) 21 * 3 is 63 (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 21. 21 Exceptions and try-except zException handling via try-except statement (c) 1998-2015 CyberWeb Consulting. All rights reserved. try: # statements to monitor except ExceptionName as e: # code to exec if ExceptionName occurs try: f = open('data.txt', 'r') except IOError as e: print("Can't open file:", e) return False # or sys.exit(1), etc. zThrow exceptions with raise; there is also a finally Python 2 vs. Python 3 „ The What and the Why „ Fix early design flaws „ Some new features, many small improvements „ Plan: develop (remainder of) 2.x and 3.x together „ Provide transition tools (2to3, 2.6+, -Q, -3) „ Key Updates (no major syntax changes) „ print, exec changed to functions „ True division: 1/2 == 0.5 „ Performance (more iterators, fewer lists) „ Consolidation/unification (integers, classes) „ Strings: Unicode default; bytes/bytearray types „ Intro to Python 3 article FYI „ informit.com/articles/article.aspx?p=1328795 (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 22. 22 Where do you go from here? •The tip of the iceberg… zSystem Administration scripting tools and automation zNetworked/Internet Client-Server systems zGraphical User Interface (GUI) design and development zWeb frameworks and rich Internet applications (RIA) zScientific/numeric/mathematics-centric development zDatabase programming, Object-Relational Mappers (ORMs) zXML, JSON, CSV and other forms of text processing zJava with Jython; .NET/Mono with IronPython; COM, MFC zGraphics/imaging/multimedia/visual art processing zMultithreaded and higher-performance applications zEmbedded system design (hardware as well as Python) zQA/Testing automated test tools, suites, and frameworks zRapid application prototyping (all application areas) (c) 1998-2015 CyberWeb Consulting. All rights reserved. Additional Resources zBooks for programmers (more @ goo.gl/i4u0R) zQuick Python Book (2010) zPython Fundamentals LiveLessons DVD (Chun, 2009) zCore Python Programming (2006 [2009]) zDive into Python (2009, 2004) zBeginning Python: From Novice to Professional (2008) zPython Cookbook (2013, 2005) zPython Standard Library by Example (2011) zPython Essential Reference (2009) & Python in a Nutshell (2006) zSome online resources zPython Quick Reference Guide rgruet.free.fr#QuickRef zPython Conferences worldwide www.pycon.org zCore Python Programming corepython.com zMailing list/newsgroup groups.google.com/group/comp.lang.python zPython Docs (+ FAQ, tutorial,…) docs.python.org zExternal 3rd-party/ repo python.org/pypi (c) 1998-2015 CyberWeb Consulting. All rights reserved.
  • 23. 23 The Zen of Python (or import this by Tim Peters) 1. Beautiful is better than ugly. 2. Explicit is better than implicit. 3. Simple is better than complex. 4. Complex is better than complicated. 5. Flat is better than nested. 6. Sparse is better than dense. 7. Readability counts. 8. Special cases aren't special enough to break the rules. 9. Although practicality beats purity. 10. Errors should never pass silently. 11. Unless explicitly silenced. 12. In the face of ambiguity, refuse the temptation to guess. 13. There should be one — and preferably only one — obvious way to do it. 14. Although that way may not be obvious at first unless you're Dutch. 15. Now is better than never. 16. Although never is often better than right now. 17. If the implementation is hard to explain, it's a bad idea. 18. If the implementation is easy to explain, it may be a good idea. 19. Namespaces are one honking great idea — let's do more of those! (c) 1998-2015 CyberWeb Consulting. All rights reserved. Thank you! Questions? (c) 1998-2015 CyberWeb Consulting. All rights reserved. # Google+ # Twitter +Wesley Chun @wescpy wescpy @gmail # e-mail corepython.com # books cyberwebconsulting.com # training wescpy.blogspot.com # Python blog wesc.livejournal.com # personal blog