Skip to main content

Introducing new learning courses and educational videos from Apress. Start watching

  • Book
  • © 2017

Python 2 and 3 Compatibility

With Six and Python-Future Libraries

Apress

Authors:

  • Explains forward compatibility to create Python 2 code that will run on both Python 2 and 3

  • Provides a manual for Python project maintainers to support both versions

  • Uses two popular Python libraries, Python-Future and Six

Buying options

eBook EUR 12.99 EUR 22.99
Discount applied Price includes VAT (Netherlands)
  • ISBN: 978-1-4842-2955-2
  • Instant EPUB and PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
Softcover Book EUR 30.51
Price includes VAT (Netherlands)
  • ISBN: 978-1-4842-2954-5
  • Dispatched in 3 to 5 business days
  • Exclusive offer for individuals only
  • Free shipping worldwide
    See shipping information.
  • Tax calculation will be finalised during checkout

This is a preview of subscription content, access via your institution.

Table of contents (12 chapters)

  1. Front Matter

    Pages i-xxix
  2. Printing and Backtick repr

    • Joannah Nanjekye
    Pages 1-10
  3. Numbers

    • Joannah Nanjekye
    Pages 11-19
  4. Setting Metaclasses

    • Joannah Nanjekye
    Pages 21-30
  5. Strings and Bytes

    • Joannah Nanjekye
    Pages 31-46
  6. Package Imports

    • Joannah Nanjekye
    Pages 47-52
  7. Exceptions

    • Joannah Nanjekye
    Pages 53-58
  8. HTML Processing

    • Joannah Nanjekye
    Pages 59-63
  9. Working with Files

    • Joannah Nanjekye
    Pages 65-68
  10. Custom Behavior of Classes

    • Joannah Nanjekye
    Pages 69-79
  11. Collections and Iterators

    • Joannah Nanjekye
    Pages 81-94
  12. More Built-ins

    • Joannah Nanjekye
    Pages 95-109
  13. Standard Library Modules

    • Joannah Nanjekye
    Pages 111-125
  14. Back Matter

    Pages 127-129

About this book

Discover clean ways to write code that will run on both Python 2 and 3.This book is tutorial-oriented with detailed examples of how to convert existing Python 2-compatible code to code that will run reliably on both Python 2 and 3. 

Although Python 3 is considered the future of Python, Python 2.x will be maintained for several more years, alongside Python 3, which is not backwards compatible. For those who need to support both versions, this book guides you through the process. 

Python 2 and 3 Compatibility explains the syntactical differences between Python 2 and 3, and how to use Python packages Python-Future and Six to implement neutral compatibility. Developers working on either small, medium, or large projects will appreciate the author's clear explanations, detailed examples, and clean techniques to help them extend support for both versions to their existing Python 2-compatible projects.

What You'll Learn

  • Understand the syntactical differences between Python 2 and 3
  • Use the Six and Future libraries
  • Review the new features in Python 3
  • Choose which Python versions to support when doing neutral support
  • Decide on whether to port or provide support for both versions

Who This Book Is For

Professional Python developers and enthusiasts that want to implement Python 3 support for their existing Python 2 compatible code.

Keywords

  • Python 3
  • Compatibility
  • Python-Future
  • Python Six Library
  • Programming
  • package
  • Library modules
  • Classes
  • Python 2 and 3
  • Python Neutral Support

Authors and Affiliations

  • Kampala, Uganda

    Joannah Nanjekye

About the author

Joannah Nanjekye is from Uganda, a software engineer, conference speaker and a proud FOSS (Free and Open Source Software) contributor who presented at PyCon ZA in South Africa in 2016 and 2017. She shares her knowledge on implementation for Python 2 and 3 support from experiences on her work on open source projects. She worked as software developer for Laboremus Uganda and Fintech Uganda before pursuing a career as Aeronautical Engineer with a bias in Avionics at Kenya Aeronautical College. She is a proud Rails Girls Summer of Code alumnae and was mentored into FOSS development during her time as a scholar.

Bibliographic Information

  • Book Title: Python 2 and 3 Compatibility

  • Book Subtitle: With Six and Python-Future Libraries

  • Authors: Joannah Nanjekye

  • DOI: https://doi.org/10.1007/978-1-4842-2955-2

  • Publisher: Apress Berkeley, CA

  • eBook Packages: Professional and Applied Computing, Professional and Applied Computing (R0), Apress Access Books

  • Copyright Information: Joannah Nanjekye 2017

  • Softcover ISBN: 978-1-4842-2954-5Published: 08 December 2017

  • eBook ISBN: 978-1-4842-2955-2Published: 07 December 2017

  • Edition Number: 1

  • Number of Pages: XXIX, 129

  • Number of Illustrations: 1 illustrations in colour

  • Topics: Python

Buying options

eBook EUR 12.99 EUR 22.99
Discount applied Price includes VAT (Netherlands)
  • ISBN: 978-1-4842-2955-2
  • Instant EPUB and PDF download
  • Readable on all devices
  • Own it forever
  • Exclusive offer for individuals only
  • Tax calculation will be finalised during checkout
Softcover Book EUR 30.51
Price includes VAT (Netherlands)
  • ISBN: 978-1-4842-2954-5
  • Dispatched in 3 to 5 business days
  • Exclusive offer for individuals only
  • Free shipping worldwide
    See shipping information.
  • Tax calculation will be finalised during checkout