Treading on Python: Volume 1 Beginning Python
$11.99
Minimum price
$14.99
Suggested price

Treading on Python: Volume 1 Beginning Python

About the Book

Learn Python Quickly

Python is an incredible language. It is powerful and applicable in many areas. It is used for automation of simple or complex tasks, numerical processing, web development, interactive games and more. Whether you are a programmer coming to Python from another language, managing Python programmers or wanting to learn to program, it makes sense to cut to the chase and learn Python the right way. You could scour blogs, websites and much longer tomes if you have time. Treading on Python lets you learn the hints and tips to be Pythonic quickly.

Packed with Useful Hints and Tips

You’ll learn the best practices without wasting time searching or trying to force Python to be like other languages. I’ve collected all the gems I’ve gleaned over years of writing and teaching Python for you.

What you will learn

  • Distilled best practices and tips
  • How interpretted languages work
  • Using basic types such as Strings, Integers, and Floats
  • Best practices for using the interpreter during development
  • The difference between mutable and immutable data
  • Sets, Lists, and Dictionaries, and when to use each
  • Gathering keyboard input
  • How to define a class
  • Looping constructs
  • Handling Exceptions in code
  • Slicing sequences
  • Creating modular code
  • Using libraries
  • Laying out code
  • Community prescribed conventions

About the Author

Matt Harrison
Matt Harrison

Matt Harrison has over 10 years Python experience across the domains of search, build management and testing, business intelligence and storage.

He has presented and taught tutorials at conferences such as SCALE, PyCON and OSCON as well as local user groups. In addition he has been a private tutor teaching programming to teenagers as well as retired folk. The structure of this book is based off of his first hand experience teaching Python to many individuals.

Matt occasionally tweets useful Python related information at __mharrison__ and Matt blogs at hairysun.com

Table of Contents

  • Introduction
  • Why Python?
  • Which Version of Python?
    • Python installation
    • Which editor?
  • The Interpreter
    • Interactive interpreter
    • A REPL example
  • Running Programs
    • Unixy embellishments
  • Writing and Reading Data
    • Simple output
    • Getting user input
  • Variables
    • Mutation and state
    • Python variables are like tags
    • Cattle tags
  • Basic Types
    • Strings
    • Integers and floats
    • Booleans
    • Rebinding variables
    • Naming variables
    • Additional naming considerations
  • More about objects
    • Identity
    • Type
    • Mutability
  • Numbers
    • Addition
    • Subtraction
    • Multiplication
    • Division
    • Modulo
    • Power
    • Order of operations
  • Strings
  • Formatting Strings
    • Format string syntax
    • format examples
  • dir, help, and pdb
    • Dunder methods
    • help
    • pdb
  • Strings and methods
    • Common string methods
    • endswith
    • find
    • format
    • join
    • startswith
    • strip
  • Comments, Booleans, and None
    • Comments
    • Booleans
    • None
  • Conditionals and whitespace
    • Combining conditionals
    • if statements
    • else statements
    • More choices
    • Whitespace
  • Sequences: Lists, tuples, and sets
    • Lists
    • Sequence indices
    • List insertion
    • List deletion
    • Sorting lists
    • Useful list hints
    • Tuples
    • Sets
  • Iteration
    • Looping with an index
    • Breaking out of a loop
    • Skipping over items in a loop
    • Removing items from lists during iteration
    • else clauses
  • Dictionaries
    • Dictionary assignment
    • Retrieving values from a dictionary
    • The in operator
    • Dictionary shortcuts
    • setdefault
    • Deleting keys
    • Dictionary iteration
  • Functions
    • Invoking functions
    • Multiple parameters
    • Default parameters
    • Naming conventions for functions
  • Indexing and Slicing
    • Indexing
    • Slicing sub lists
    • Striding slices
  • File Input and Output
    • Opening files
    • Reading files
    • Iteration with files
    • Writing files
    • Closing files
    • Designing around files
  • Classes
    • Defining a class
    • Creating an instance of a class
    • Calling a method on a class
    • Examining an instance
  • Subclassing a Class
    • Superclasses
    • Calling parent class methods
  • Exceptions
    • Look before you leap
    • Easier to ask for forgiveness
    • Multiple exceptional cases
    • finally clause
    • else clause
    • Raising exceptions
    • Defining your own exceptions
  • Importing libraries
    • Multiple ways to import
    • Conflicting import names
    • Star imports
    • Nested libraries
    • Import organization
  • Libraries: Packages and Modules
    • Modules
    • Packages
    • Importing packages
    • PYTHONPATH
    • sys.path
  • A complete example
    • cat.py
    • Common layout
    • Shebang
    • Docstring
    • Imports
    • Metadata and globals
    • Logging
    • Other globals
    • Implementation
    • Testing
    • if __name__ == '__main__':
    • __name__
  • Onto Bigger and Better
  • About the Author
    • About the Technical Editor

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub