The Python Journeyman
Minimum price
Suggested price

The Python Journeyman

About the Book

The Python Journeyman is the second book in our trilogy covering the core Python language. The material in these books is derived from Sixty North's popular and battle-tested training courses which have led thousands of programmers on a journey to being productive with Python.

Our books, which use Python 3, follow a spiral curriculum: We introduce topics gently and then revisit them on multiple occasions to add the depth required to support your progression as a Python developer. We've worked hard to structure the syllabus to avoid forward references. On only a few occasions do we require you to accept techniques on trust, before explaining them later; where we do, it's to deliberately establish good habits.

  • Share this book

  • Categories

    • Python
  • Feedback

    You must own a copy of this Book to access the forums.

    Email the Author(s)

About the Authors

Robert Smallshire
Robert Smallshire

Robert Smallshire is a founding director of Sixty North, a software consulting and training business in Norway providing services throughout Europe, and which uses Python extensively. Robert has worked in senior architecture and technical management roles for several software companies providing tools in the energy sector. He has dealt with understanding, designing, advocating and implementing effective architectures for sophisticated scientific and enterprise software in Python, C++, C# and F# and Javascript. Robert is a regular speaker at conferences, meetups and corporate software events and can be found speaking about topics as diverse as behavioural microeconomics in software development to implementing web services on 8-bit microcontrollers. He is organiser of the Oslo Python group and holds a Ph.D. in a natural science.

Austin Bingham
Austin Bingham

Austin is a founding director of Sixty North, a software consulting, training, and application development company. A native of Texas, in 2008 Austin moved to Stavanger, Norway where he helped develop industry-leading oil reservoir modeling software in C++ and Python. Prior to that he worked at National Instruments developing LabVIEW, at Applied Research Labs (Univ. of Texas at Austin) developing sonar systems for the U.S. Navy, and at a number of telecommunications companies. He is an experienced presenter and teacher, having spoken at numerous conferences, software groups, and internal corporate venues. Austin is also an active member of the open source community, contributing regularly to various Python and Emacs projects, and he’s the founder of Stavanger Software Developers, one of the largest and most active social software groups in Stavanger. Austin holds a Master of Science in Computer Engineering from the University of Texas at Austin.

Sixty North
Sixty North

Sixty North AS. Software Consulting and Training.

Bundles that include this book

Bought separately
Bundle Price

Table of Contents

  • Preface
    • Errata and Suggestions
    • Conventions Used in This Book
  • Welcome Journeyman!
  • Prerequisites
    • A functioning Python 3 runtime
    • Defining function, passing arguments, and returning values
    • Creating, importing and executing modules
    • Built­-in types: Integers, Floats, Strings, Lists, Dictionaries and Sets
    • Fundamentals of the Python object model
    • Raising and handling exceptions
    • Iterables and iterators
    • Defining classes with methods
    • Reading and writing text and binary files
    • Unit testing, debugging and deployment
  • Well begun is half done
  • Chapter 1 - Organizing Larger Programs
    • Packages
    • Implementing packages
    • Relative imports
    • __all__
    • Namespace packages
    • Executable directories
    • Executable packages
    • Recommended layout
    • Modules are singletons
    • Summary
  • Chapter 2 - Beyond Basic Functions
    • Review of Functions
    • Functions as callable objects
    • Callable instances and the __call__() method
    • Classes are Callable
    • Leveraging callable classes
    • Lambdas
    • Detecting Callable Objects
    • Extended Formal Parameter Syntax
    • Extended Call Syntax
    • Transposing Tables
    • Summary
  • Chapter 3 - Closures and Decorators
    • Local functions
    • Closures and nested scopes
    • Function decorators
    • Validating arguments
    • Summary
  • Chapter 4 - Properties and Class Methods
    • Class attributes
    • Static methods
    • Class methods
    • Named constructors
    • Overriding static- and class-methods
    • Properties
    • Overriding properties
    • The template method pattern
    • Summary
  • Chapter 5 - Strings and Representations
    • Two string representations
    • Strings for developers with repr()
    • Strings for clients with str()
    • When are the representation used?
    • Precise control with format()
    • Leveraging reprlib for large strings
    • The ascii(), ord() and chr() built-in functions
    • Case study: String representations of tabular data
    • Summary
  • Chapter 6 - Numeric and Scalar Types
    • Python’s basic numeric types
    • The limits of floats
    • The decimal module
    • The fractions module
    • Complex Numbers
    • Built-in functions relating to numbers
    • Dates and times with the datetime module
    • Case study: Rational numbers and computational geometry
    • Summary
  • Chapter 7 - Iterables and Iteration
    • Review of comprehensions
    • Multi-input comprehensions
    • Functional-style tools
    • map()
    • filter()
    • functools.reduce()
    • Combining functional concepts: map-reduce
    • The iteration protocols
    • Case study: an iterable and iterator for streamed sensor data
    • Summary
  • Chapter 8 - Inheritance and Subtype Polymorphism
    • Single inheritance
    • Type inspection
    • Multiple inheritance
    • MRO: Method Resolution Order
    • super()
    • object
    • Inheritance for Implementation Sharing
    • Summary
  • Chapter 9 - Implementing Collections with Protocols
    • Collection protocols
    • Test first
    • The initializer
    • The container protocol
    • The sized protocol
    • The iterable protocol
    • The sequence protocol
    • The set protocol
    • Summary
  • Chapter 10 - Errors and Exceptions in Depth
    • Exception dangers
    • Exceptions hierarchies
    • Exception payloads
    • User-defined exceptions
    • Exception chaining
    • Tracebacks
    • Assertions
    • Preconditions, postconditions and assertions
    • Summary
  • Chapter 11 - Defining Context Managers
    • What is a context manager?
    • The context manager protocol
    • contextlib.contextmanager
    • Multiple context-managers in a with-statement
    • Context managers for transactions
    • Summary
  • Chapter 12 - Introspection
    • Introspecting types
    • Introspecting objects
    • Introspecting scopes
    • The inspect module
    • An object introspection tool
    • Summary
  • Afterword: Levelling Up
  • Appendix A - Python implementation of ISO6346
  • Notes

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.

See full terms

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

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

In fact, authors have earnedover $12 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