­­Preface

 

 

 

 

Python 2.X or 3.X?

 

This class and its workbook apply to and teach both the Python 2.X and 3.X lines, and students are welcome to install and use either version in class depending on their needs and interests. By default, the class uses the latest 3.X release and points out version differences along the way, but this is flexible, and some workbook material is still in 2.X form.

 

Python 3.X is a newer version (dialect) of the language which is not fully backward compatible with most existing 2.X software.  It’s not too radically different, but most 2.X code doesn’t run under 3.X unchanged.  For instance, in 3.X printing becomes a function, strings become Unicode, and generators are more pervasive—all concepts we'll explore in this class.  To you, this means:

 

       If you'll be using 2.X-based systems or libraries after the class (and many people today still will), you'll probably want to use and focus on 2.X during the class.

       If you have no 2.X legacy dependencies, 3.X is a viable option for both this class and new code today, and is generally recommended for students.

 

For more on the 2.X/3.X choice, as well as some recent 2.X and 3.X changes that may not yet be incorporated into this workbook:

 

       See the 3.X changes lists on the Advanced Topics section at the end of this workbook, and this online review

       Read the overview at Python's wiki page http://wiki.python.org/moin/Python2orPython3

       Visit the notes sections of the book updates pages for the 3rd, 4th, and 5th Editions of the book Learning Python at web page http://learning-python.com/books/about-lp.html

       Or simply ask during the class: we'll be exploring some 3.X-only topics along the way.

 

Also see the README.txt file in the Python folder here for more pointers on which version to install if needed; in general, the latest Python is the best Python, unless you will need to use an older release after the class.

 

 

 

 

About This Class

 

Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: pythonHi

 

This class introduces students to the Python programming language, and common Python applications.  Through lectures and hands-on laboratory work, students learn the basics of Python programming.  We’ll both study the Python language, and survey common Python application domains such as GUIs, databases, web sites, and system tools.

 

This class presents Python in a bottom-up fashion – we start with small details and build to larger and larger examples as we move along.  This class is also designed to provide an in-depth look at Python itself, and a general and broad survey of Python applications – although we will study some advanced Python application domains, we won’t have time to do full justice to most.  Specialized domains (e.g., [tT]kinter GUIs, numeric programming, Internet scripting) can be more thoroughly covered in follow-up books and classes. 

 

There are no real prerequisites for most of this course, though the last two modules on C integration, if covered, will be more meaningful if you have basic C programming skills.  Any prior programming or scripting experience applies, no matter how minor.  For more details about this course, see the instructor’s training webpage (http://learning-python.com).

 

 

 

 

About the Code Examples

 

 

The examples in this course are based on Python versions 2.5 and later (at this writing, 2.7 and 3.5 are the latest and greatest releases).  We will look at some cutting edge new features of Python along the way; but since later releases are generally backward compatible with earlier ones, most of the material here should apply earlier Python releases as well.

 

Source code for all the lecture examples and laboratory exercises is available on this CD.  You may also cut and paste code from these web pages, and at the end of unit web pages you will find links to source-code file directories on this CD-ROM for exercise solutions and lecture examples.

 

Though this class’s code is generally version agnostic, as of 2009 this class covers both the Python 2.X and 3.X lines, depending on students’ needs and interests:

 

       When most students will use 2.X-based software after the class, we emphasize 2.X but note 3.X differences along the way. 

       When most students have no legacy code dependencies, we stress 3.X and note 2.X differences. 

 

Because of this dual-version focus, some code examples may be in 2.X or 3.X form, but will be noted as such as appropriate for the audience (and by the time you see them, you’ll likely know how to translate).  For more on the 2.X/3.X choice, please see the start of this page.

 

 

 

 

Suggested Supplemental Books

 

Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: Description: ora-pp3e-small

 

Because this class workbook is a self-contained document, there are no additional required texts for this class. However, students may wish to obtain related books to serve as supplemental resources. There are very many Python books and other materials available today (you can find hundreds of Python books at Amazon), but here are some suggestions.

 

Directly related books

The core language sections and the majority of this class parallel the book Learning Python, 5th Edition (June, 2013), and the more advanced applications-level material in this class parallel the book Programming Python, 4th Edition (December, 2010) both published by O’Reilly Media.

The first of these two cover language fundamentals for both Python 2.X and 3.X.  It is both based upon and helped to shape the main portion of this class, and its core language coverage pertains to every Python user, regardless of their intended application domains. 

The latter book is an advanced continuation of the former, and is focused on applications-level programming topics—what you can do with Python after you’ve learned it.  Its 3rd Edition used Python 2.X; its newer 4th Edition uses Python 3.X only, but stresses concepts that span versions.

Some clients may wish to provide students with copies of either or both of these texts for use after the class, depending upon student interest and skill levels.  If you need to obtain copies of these books, they can be purchased from most large or technical bookstores, directly from O’Reilly (see URL http://www.oreilly.com/), or retails such as Barnes & Noble and amazon.com.

 

Other suggested books

Though not required for this class, O’Reilly’s Python Pocket Reference, 5th Edition (January, 2014) is also suggested as a reference supplement that will prove handy after the class.  This reference-only book covers both Python 2.X and 3.X, and also serves as a translation resource.

 

 

 

 

Course Topics

 

 

 

Introducing Python

A brief look at history, design philosophy, and uses

 

General Python introduction

 

 

Python Language

The main focus of the class, which spans application domains

 

Using the interpreter

Types and operators

Basic statements

Functions

Modules

Classes

Exceptions

Built-in tools

 

 

Python Applications

Surveys of common roles, covered as time allows and interest warrants

 

System interfaces

GUI programming

Databases and persistence

Text processing

Internet scripting

Extending Python in C/C++

Embedding Python in C/C++

Advanced Topics

 

 

Where to go from here?

Python resources

 

 

 

 

Daily Schedule

 

For a general hourly breakdown, please see:

        http://learning-python.com/python-session-schedule.pdf

 

Each class proceeds at a slightly different rate, and our schedule is going to vary each day.  Typically, there will four to six lectures sessions per day, with laboratory work time after each, and an hour for lunch.  The exact session schedule depends on student needs and interests, and on how much interaction students require or desire; questions and comments at any time are always encouraged, and help drive the course.

 

Also note that we never cover all the material in this workbook in a 3-day class.  In general, the workbook contains a superset of topics to be presented, and some of its examples are included for student self-study only.  Material skipped is either of minor importance, or optional reading.  We may also sometimes depart from the workbook to explore special topics of interest to students.  This is your class – please ask about topics not listed above.

 

 

 

 

About the Instructor

Mark Lutz is a leading Python trainer, the author of Python’s earliest and best-selling texts, and a pioneering figure in the Python world.

Mark is the author of the three popular O'Reilly books Learning PythonProgramming Python, and Python Pocket Reference, all currently in 4th or 5th Editions.  He has been using and promoting Python since 1992, started writing Python books in 1995, and began teaching Python classes in 1997.  As of summer 2015, Mark has instructed 260 Python training sessions; taught roughly 4,000 students in live classes; and written Python books which have sold over 500,000 units and been translated to at least a dozen languages.

Together, his two decades of Python efforts have helped to establish it as one of the most widely-used programming languages in the world today.  In addition, Mark has been in the software field for 30 years.  He holds BS and MS degrees in computer science from the University of Wisconsin where he explored implementations of the Prolog language, and over his career has worked as a professional software developer on compilers, programming tools, scripting applications, and assorted client/server systems.

Mark can be reached by email at lutz@learning-python.com.  He maintains two sites on the web—http://learning-python.com/books for book support, and http://learning-python.com/training for training—but hasn’t updated his resume in quite some time.