Slide deck for the 45-60-minute introduction to Python session talk delivered at Silicon Valley CodeCamp 2015: https://www.siliconvalley-codecamp.com/Session/2015/what-is-python
ABSTRACT
Python is an agile object-oriented programming language that continues to build momentum. It can do everything Java, C/C++/C#, Ruby, PHP, and Perl can do, but it's also fun & intuitive! Enjoy coding as fast as you think with a simple yet robust syntax that encourages group collaboration. It is known for several popular web frameworks, including Django (Python's equivalent to Ruby on Rails), Pyramid, and web2py. There is also Google App Engine, where Python was the first supported runtime. Users supporting Zope, Plone, Trac, and Mailman will also benefit from knowing some Python. Python can do XML/ReST/XSLT, multithreading, SQL/databases, GUIs, hardcore math/science, Internet client/server systems & networking (heard of Twisted?), GIS/ESRI, QA/test, automation frameworks, plus system administration tasks too! On the education front, it's a great tool to teach programming with (especially those who have done Scratch or Tynker already) as well as a solid (first) language to learn for non-programmers and other technical staff. Finally, if Python doesn't do what you want, you can extend it in C/C++, Java, or C# (even VB.NET)! Have you noticed the huge growth in the number of jobs on Monster & Dice that list Python as a desired skill? Come find out why Google, Yahoo!, Disney, Cisco, YouTube, LinkedIn, Yelp, LucasFilm/ILM, Pixar, NASA, Ubuntu, Bank of America, and Red Hat all use Python!
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
What is Python? (Silicon Valley CodeCamp 2015)
1. 1
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
What is Python?
An Introduction
"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
+Wesley Chun, Principal
CyberWeb Consulting
cyberwebconsulting.com
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Python
is
Fun!
(I've used it at lots of places!)
2. 2
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
(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!)
3. 3
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
I've taught it at
lots of places!
(companies, schools, etc.)
4. 4
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
About You
SW/HW Engineer/Lead
Sys Admin/IS/IT/Ops
Web/Flash Developer
QA/Testing/Automation
Scientist/Mathematician
Toolsmith, Hobbyist
Release Engineer/SCM
Artist/Designer/UE/UI/UX
Student/Teacher
Familiar with…
Java, C, C++, C#
PHP, JavaScript
(Visual) Basic
Perl, Tcl, Ruby
any other high-
level language…
Django, Pyramid, web2py, Flask, Fabric, Plone, Trac, Mailman, App Engine
5. 5
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Why are you here? You…
Have heard good word-of-mouth
Came via Django, App Engine, Plone, etc.
Discovered Google, Yahoo!, et al. use it
Already know but want formal training
Were forced by your boss
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)
6. 6
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
For New Programmers
Programming should be easy enough
to teach like reading & writing (CP4E)
What you need to be good
Some math background
Algebra, physics (problem solving)
Buddy who already is a developer
Even better if they know Python
Tinkerer, curious, itch-scratcher
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
About this Talk
Goal: Introduce as much Python as one can in an hour
Seminar Topics
Language Introduction
Python Object Types
Loops and Conditionals
Files, Functions, Modules
Object-Oriented Programming
Errors and Exception Handling
Miscellaneous
7. 7
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Background
Guido van Rossum: began late '89, released early '91
Inherits from ABC, Modula, C/C++, LISP, ALGOL, Perl, Java, etc.
Named after Monty Python, not the snake
Cross-platform (Mac, PC, *ix; only need a C compiler)
Alternate implementations: Jython, IronPython, Stackless, PyPy, etc.
Philosophy, Concepts and Syntax
Robust Enough "batteries included" to get job done
Simple Clean, easy-to-read, easier than VB?!?
Modular Plug-n-play, use only what you need
Extensible Can extend language to meet your needs
Intuitive "Python fits your brain."
OOP Object-oriented when you need it (not req'd)
"Pythonic" "There's only one way to do it…."
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Disadvantages?
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!
Why (not) Python?
Advantages
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
8. 8
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Built for Non-Programmers
Educational language syntax
Scratch (Tynker, Blockly, App Inventor) , Alice, Python, HTML
Works well for school-aged children
Syntax, memory mgmt, data structures, OOP…
Obstacles to learning concepts, deters interest
Python: retention, morale, understanding
Probably the "best" 1st language
What about professional developers?
C/C++, Java, PHP, Python, Ruby, JavaScript
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Some Newbie Resources
Published Books
Hello World! Computer Programming for Kids & Other Beginners
(Sande, Sande: 2013)
Invent Your Own Computer Games with Python (Sweigart: 2015)
Python for Kids (Briggs: 2012; see Snake Wrangling for Kids)
Automate the Boring Stuff with Python: Practical Programming for
Total Beginners (Sweigart: 2015)
Learning with Python: How to Think Like a Computer Scientist
(Downey, Elkner, Meyers: 2002)
Online Books, Tutorials, Environments, etc.
How to Think Like a Computer Scientist (Downey, Elkner, Meyers)
Learning to Program (Gauld)
LiveWires Python course
A Byte of Python (Swaroop)
Instant Hacking: Learning to Program with Python (Hetland)
Snake Wrangling for Kids (Briggs)
Computer Programming is Fun! (Handy)
Karel the Robot clones: Guido van Robot, RUR-PLE
9. 9
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Run Python interactive interpreter from default IDE: IDLE
Or do it from the cmd-line or DOS command shell
$ python # or C:> python
Python 2.7.10 (default, Jul 27 2015, 11:35:10)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> print 'Hello World!'
Hello World!
Interactive Interpreter
To exit: Ctrl-D in IDLE or *ix
cmd line; or Ctrl-Z in DOS
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
What You Just Saw
>>> this is the Python prompt
Enter any Python command after it
Use print to display output to users
Use print() in Python 3
To exit interactive interpreter
Ctrl-D from IDLE or *ix command-line
Ctrl-Z from a DOS/command shell
Interactive Interpreter: testing, debugging, hacking,
experimenting regardless of IDE use or otherwise
10. 10
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Getting Python
POSIX (Mac OS, *nix): already installed
PC, source, and other downloads
python.org or corepython.com
Other IDEs
SPE (pictured)
PythonWin
Eclipse & PyDev
PyCharm/intelliJ
Komodo
WingIDE
IPython Notebook
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
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
11. 11
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Online learning systems
•Learn & code Python with these learning environments
•Codecademy
•codecademy.com/tracks/python
•PySchools
•pyschools.com
•Online Python Tutor
•pythontutor.com
•Online Python course
•Udacity
•udacity.com/course/cs101
•Coursera
•coursera.org/course/interactivepython
•coursera.org/course/programming1
•LearnPython.org
•learnpython.org
•CodingBat (login optional)
•codingbat.com/python
•SingPath (login required)
•singpath.com
(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
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Common Beginner Gotchas
Code delimited by indentation not braces { }
if x > 10:
return "'x' is greater than 10"
else:
return "'x' is less than 10"
No extraneous characters ( ; , $, ……)
No switch-case, private class members, ++/--,
static type checking, anonymous blocks, etc.
Freaky-looking floats*: 1.1 1.10000000001
Single element tuple needs comma: (None,)
3.x-only: print() & true div: 1/2 == 0.5
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
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
13. 13
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Objects
Standard Data Types
Numbers (3-8)
Strings (2-3)
Lists
Tuples
Dictionaries
Sets (2)
Other Types
None
Files, Modules
Functions/Methods
Iterators/Generators
Type/Classes
miscellaneous
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.
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)
14. 14
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Numbers
integers (no size limit except for VM)
-680, 0o237, 0xDEADBEEF, 64-0x41, 0b110
floating point real numbers (IEEE-754 C double)
-97.65, -3.14159, -6e2, 0.1
complex numbers
Composed of real and imaginary parts (floats)
11.65-5.55J, 4J, -3e2+8.73J, 0.1-2.3e4J
Also long, bool, Decimal, Fraction, Rational, etc.
Other modules: math, cmath, random, operator
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Strings ' ' " " ''' '''
Strings are sequences of characters (single/double quotes)
No 'char' type… strings of length 1
Format operator ( % ) for printf()-like functionality
Flexible alternative: string format() method (new in 2.6)
Triple quotes allow special characters like newlines
>>> 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
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Lists [ ] and Tuples ( )
Lists: ordered sequences of arbitrary objects
Mutable (values can be updated)
Can have lists of lists, i.e., multidimensional indexing
Tuples similar but immutable (no value updates allowed)
"List comprehensions" allows for quick logical building of lists
Common list methods:
list.sort() # "sort" list contents in-place
list.reverse() # reverse a list in-place
list.append() # append item to list
list.insert() # insert items in list
list.remove/pop() # remove item(s) from list
list.extend() # extend a list with another one
list.count() # return number of item occurrences
list.index() # lowest index where item is found
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
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()
16. 16
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Dictionaries { }
Dictionaries (sets like dicts but only hashed keys)
Mutable, resizable hash tables
Mappings of keys to values
Keys: scalar (usually strings or numbers)
Values: arbitrary Python objects
No key collisions allowed
Similar to Java HashMap, JS Object, Perl hash/associative array
Most commonly-used methods:
d.items() # iterable: key-value pairs
d.get() # return key's value (or default)
d.setdefault() # return key's value, set if nec.
d.pop() # remove item from d and return
d.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
17. 17
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
if-elif-else Statements
Conditional statements are what you expect
# prompt, get, and check user input
data = raw_input("Enter 'y' or 'n': ")
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
Ternary Operator (aka Conditional Expressions: C ? T : F)
smaller = x if x < y else y # T if C else F
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Loops
Python while loops are same as in other languages
for more like shell foreach & used ~90% over while
Iterate over elements rather than counting/conditional
range() helps "simulate" traditional for loops
Loop "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
>>> i = 0
>>> while i < 3:
... print(i)
... i += 1
0
1
2
18. 18
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Open a file and get back a file object
f = open(name, mode) # mode: r/r+, w, a, U
Most commonly-used file methods
f.close() Close file
f.read() Read bytes from file
f.write() Write a string to file
Display text file example:
f = open('data.txt', 'r')
for line in f:
print(line.rstrip())
f.close()
… or, alternatively, more modern Python (2.6+)
with open('data.txt', 'r') as f:
for line in f:
print(line, end='')
Files
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Function 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
Functions heterogenous (untyped)
Default values & variable arguments supported
Can return 0, 1, or more objects
Python returns None if no return value provided
Introducing Functions
19. 19
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Importing Modules & Attributes
Importing modules or packages using import statement
import module_name
import string
num = string.atoi('123')
Importing module attributes using from-import statement
Names brought into (global) variable namespace
from module_name import module_element
from string import atoi
num = atoi('123')
Packages: allow for organizing modules using the file system
Use int()though…
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Standard Library Sampler (“B.I.”)
API for SQLite databasessqlite3
Email processingemail, {smtp,pop,imap}lib
External process managementsubprocess
Data compression and archive filesgzip, bz2, zipfile, tarfile
Various Internet client libraries{ftp,url,http,*}lib
Serialize Python objectspickle, cPickle, shelve
Various math/numberic processing{c,}math, random, fractions,……
High-level threads/multiprocess APIsthreading, multiprocessing
Python/Tk GUI toolkit interfaceTkinter
Socket interface & server classes (TCP, UDP)socket, SocketServer
Date and time constants and functionstime, datetime, calendar
Text processingre, csv, json, xml
Operating and file system interfaceos and os.path
System data, processing, and functionalitysys
DescriptionModule Name(s)
20. 20
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Programmer Tools
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
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Object-Oriented Programming
"Constructor"/Initializer is __init__(), "self" is "this"
Class instantiation via function interface (rather than "new")
Instance 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
21. 21
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Exceptions and try-except
Exception handling via try-except statement
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.
Throw exceptions with raise; there is also a finally
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
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
22. 22
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Where do you go from here?
•The tip of the iceberg…
System Administration scripting tools and automation
Networked/Internet Client-Server systems
Graphical User Interface (GUI) design and development
Web frameworks and rich Internet applications (RIA)
Scientific/numeric/mathematics-centric development
Database programming, Object-Relational Mappers (ORMs)
XML, JSON, CSV and other forms of text processing
Java with Jython; .NET/Mono with IronPython; COM, MFC
Graphics/imaging/multimedia/visual art processing
Multithreaded and higher-performance applications
Embedded system design (hardware as well as Python)
QA/Testing automated test tools, suites, and frameworks
Rapid application prototyping (all application areas)
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Additional Resources
Books for programmers (more @ goo.gl/i4u0R)
Quick Python Book (2010)
Python Fundamentals LiveLessons DVD (Chun, 2009)
Core Python Programming (2006 [2009])
Dive into Python (2009, 2004)
Beginning Python: From Novice to Professional (2008)
Python Cookbook (2013, 2005)
Python Standard Library by Example (2011)
Python Essential Reference (2009) & Python in a Nutshell (2006)
Some online resources
Python Quick Reference Guide rgruet.free.fr#QuickRef
Python Conferences worldwide www.pycon.org
Core Python Programming corepython.com
Mailing list/newsgroup groups.google.com/group/comp.lang.python
Python Docs (+ FAQ, tutorial,…) docs.python.org
External 3rd-party/ repo python.org/pypi
23. 23
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
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!
The Zen of Python (or import this by Tim Peters)
(c) 1998-2015 CyberWeb Consulting.
All rights reserved.
Thank you! Questions?
+Wesley Chun # Google+
@wescpy # Twitter
wescpy@gmail.com # e-mail
corepython.com # books
cyberwebconsulting.com # training
wescpy.blogspot.com # Python blog
wesc.livejournal.com # personal blog
24.
25. THE COMPLETE DEVELOPER'S GUIDE TO PYTHON
• New to Python? The definitive guide to Python development for
experienced programmers
• Covers core language features thoroughly, including those found in
the latest Python releases — learn more than just the syntax!
• Learn advanced topics such as regular expressions, networking,
multithreading, GUI, Web/CGI, and Python extensions
• Includes brand-new material on databases, Internet clients, Java/Jython,
and Microsoft Office, plus Python 2.6 and 3
• Presents hundreds of code snippets, interactive examples, and practical
exercises to strengthen your Python skills
Python is an agile, robust, expressive, fully object-oriented, extensible, and
scalable programming language. It combines the power of compiled languages
with the simplicity and rapid development of scripting languages. In Core
Python Programming, Second Edition, leading Python developer and trainer
Wesley Chun helps you learn Python quickly and comprehensively so that
you can immediately succeed with any Python project.
Using practical code examples, Chun introduces all the fundamentals of
Python programming: syntax, objects and memory management, data types,
operators, files and I/O, functions, generators, error handling and exceptions,
loops, iterators, functional programming, object-oriented programming and
more. After you learn the core fundamentals of Python, he shows you what
you can do with your new skills, delving into advanced topics, such as regular
expressions, networking programming with sockets, multithreading, GUI
development, Web/CGI programming and extending Python in C.
This edition reflects major enhancements in the Python 2.x series, including 2.6
and tips for migrating to 3. It contains new chapters on database and Internet client
programming, plus coverage of many new topics, including new-style classes, Java
and Jython, Microsoft Office (Win32 COM Client) programming, and much more.
• Learn professional Python style, best practices, and good programming habits
• Gain a deep understanding of Python's objects and memory model as well
as its OOP features, including those found in Python's new-style classes
• Build more effective Web, CGI, Internet, and network and other client/
server applications
• Learn how to develop your own GUI applications using Tkinter and other
toolkits available for Python
• Improve the performance of your Python applications by writing extensions
in C and other languages, or enhance I/O-bound applications by using
multithreading
• Learn about Python's database API and how to use a variety of database
systems with Python, including MySQL, Postgres, and SQLite
• Features appendices on Python 2.6 & 3, including tips on migrating to the
next generation!
Core Python Programming
Second Edition
"The long-awaited second
edition of Wesley Chun's
Core Python Programming
proves to be well worth the
wait–its deep and broad
coverage and useful exercises
will help readers learn and
practice good Python."
— ALEX MARTELLI,
author of Python in a Nutshell and
editor of Python Cookbook
"There has been lot of good
buzz around Wesley Chun's
Core Python Programming.
It turns out that all the buzz is
well earned. I think this is the
best book currently available
for learning Python. I would
recommend Chun's book over
Learning Python (O'Reilly),
Programming Python
(O'Reilly), or The Quick Python
Book (Manning)."
— DAVID MERTZ, Ph.D.,
IBM DeveloperWorks®
"Finally, a book good enough
to be both a textbook and
a reference on the Python
language now exists."
— MICHAEL BAXTER,
Linux Journal
Wesley Chun
FOR MORE INFORMATION PLEASE VISIT:
informit.com/python
Available wherever technical books are sold.
AVAILABLE
• BOOK: 9780132269933
• SAFARI ONLINE
• E-BOOK: 9780137060566
• SONY: 9780137061259
SAVE up to 40%
Buy 1 Save 35% | Buy 2
or More and Save 40%
Use discount code:
PYTHONCENTER at
informit.com/python
26. Other titles by
Wesley Chun
FOR MORE INFORMATION PLEASE VISIT:
informit.com/python
Available wherever technical books are sold.
SAVE up to 40%
Buy 1 Save 35% | Buy 2
or More and Save 40%
Use discount code:
PYTHONCENTER at
informit.com/python
About the Author
WESLEY J. CHUN, MSCS, is the author of Python Fundamentals, a companion
video to Core Python Programming, and the coauthor of Python Web Development
with Django. In addition to being a senior software architect, he runs CyberWeb
(cyberwebconsulting.com), a consulting business specializing in Python software
engineering and technical training. He has more than twenty-five years of
programming, teaching, and writing experience, including more than a decade
with Python. While at Yahoo!, he helped create Yahoo!Mail and Yahoo! People
Search using Python. He holds degrees in computer science, mathematics, and
music from the University of California.
Python Web Development with Django
JEFF FORCIER, PAUL BISSEX, WESLEY CHUN | ISBN: 9780132356138
Using the simple, robust, Python-based Django framework, you can build powerful
Web solutions with remarkably few lines of code. In Python Web Development with
Django®, three experienced Django and Python developers cover all the techniques,
tools, and concepts you need to make the most of Django 1.0, including all the major
features of the new release.
The authors teach Django through in-depth explanations, plus provide extensive
sample code supported with images and line-by-line explanations. You’ll discover
how Django leverages Python’s development speed and flexibility to help you solve
a wide spectrum of Web development problems and learn Django best practices
covered nowhere else. You’ll build your first Django application in just minutes and
deepen your real-world skills through start-to-finish application projects.
Python Fundamentals (Video Training)
WESLEY CHUN | ISBN: 9780137143412
FOR ANY STUDENT OR PROFESSIONAL INTERESTED IN
LEARNING THE FUNDAMENTALS OF PYTHON
In this one-of-a-kind video package, leading Python developer and trainer Wesley
Chun helps you learn Python quickly and comprehensively, so that you can
immediately succeed with any Python project.
Just click and watch: One step at a time, you will master Python fundamentals.
If you already have Python experience, these videos will help further develop
your skills. The lessons start with an introduction to the core features of the
Python language, including syntax basics and standard types and operations.
The lessons progress into advanced topics, such as Python’s memory model and
object-oriented programming.