from-future-import-python.pdf

(2384 KB) Pobierz
Picking a Python
Version: A Manifesto
From __future__ import Python
David Mertz
Picking a Python Version:
A Manifesto
From __future__ import Python
David Mertz
Picking a Python Version: A Manifesto
by David Mertz
Copyright © 2015 O’Reilly Media, Inc. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA
95472.
O’Reilly books may be purchased for educational, business, or sales promotional use.
Online editions are also available for most titles (http://safaribooksonline.com). For
more information, contact our corporate/institutional sales department:
800-998-9938 or corporate@oreilly.com.
Editor:
Meghan Blanchette
Production Editor:
Kristen Brown
Copyeditor:
Gillian McGarvey
April 2015:
First Edition
Interior Designer:
David Futato
Cover Designer:
Karen Montgomery
Illustrator:
Rebecca Demarest
Revision History for the First Edition
2015-03-12:
First Release
See
http://oreilly.com/catalog/errata.csp?isbn=9781491926970
for release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc.
Picking a Python
Version: A Manifesto,
the cover image, and related trade dress are trademarks of
O’Reilly Media, Inc.
While the publisher and the author have used good faith efforts to ensure that the
information and instructions contained in this work are accurate, the publisher and
the author disclaim all responsibility for errors or omissions, including without limi‐
tation responsibility for damages resulting from the use of or reliance on this work.
Use of the information and instructions contained in this work is at your own risk. If
any code samples or other technology this work contains or describes is subject to
open source licenses or the intellectual property rights of others, it is your responsi‐
bility to ensure that your use thereof complies with such licenses and/or rights.
978-1-491-92697-0
[LSI]
Table of Contents
Python Versions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
The (Small) Break
Moving Forward
Unix-Like Systems
Python 3 Uptake
Is It Enough?
2to3
six.py
Python-Future
Library Support
2
3
4
6
9
Porting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
12
15
16
18
23
24
24
25
25
26
26
27
29
30
31
iii
Advantages of Python 3.x. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Unicode Handling
The Greatly Improved Email and Mailbox Modules
The concurrent.futures Module
Coroutine Support and yield from
The asyncio Module
Views and Iterators Everywhere
Function Annotations
Other Things
PyPy
PyPy-STM
Jython
Other Implementations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
IronPython
Cython
Numba
Continuum Analytics’ Anaconda
Enthought’s Canopy
ActiveState’s ActivePython
32
33
34
37
37
38
Python Distributions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
iv
|
Table of Contents
Zgłoś jeśli naruszono regulamin