2010.Pro Python.pdf

(2983 KB) Pobierz
541071326 UNPDF
THE EXPERT’S VOICE ® IN OPEN SOURCE
Python
Advanced coding techniques and tools
Marty Alchin
Pro
541071326.048.png
 
541071326.062.png 541071326.071.png 541071326.001.png 541071326.009.png
 
 
541071326.010.png
 
 
541071326.011.png 541071326.012.png 541071326.013.png 541071326.014.png 541071326.015.png 541071326.016.png 541071326.017.png 541071326.018.png 541071326.019.png 541071326.020.png 541071326.021.png 541071326.022.png
 
541071326.023.png
 
541071326.024.png
 
541071326.025.png
 
541071326.026.png
 
541071326.027.png 541071326.028.png 541071326.029.png 541071326.030.png 541071326.031.png 541071326.032.png 541071326.033.png 541071326.034.png 541071326.035.png 541071326.036.png 541071326.037.png
 
541071326.038.png 541071326.039.png 541071326.040.png 541071326.041.png 541071326.042.png 541071326.043.png 541071326.044.png 541071326.045.png 541071326.046.png 541071326.047.png 541071326.049.png 541071326.050.png 541071326.051.png 541071326.052.png 541071326.053.png 541071326.054.png 541071326.055.png 541071326.056.png 541071326.057.png 541071326.058.png 541071326.059.png 541071326.060.png 541071326.061.png 541071326.063.png 541071326.064.png 541071326.065.png 541071326.066.png 541071326.067.png 541071326.068.png 541071326.069.png 541071326.070.png 541071326.072.png 541071326.073.png 541071326.074.png 541071326.075.png 541071326.076.png 541071326.077.png 541071326.078.png 541071326.079.png 541071326.080.png 541071326.002.png 541071326.003.png 541071326.004.png 541071326.005.png 541071326.006.png
Pro Python
Marty Alchin
541071326.007.png
Pro Python
Copyright © 2010 by Marty Alchin
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-4302-2757-1
ISBN-13 (electronic): 978-1-4302-2758-8
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
President and Publisher: Paul Manning
Lead Editors: Duncan Parkes, Tom Welsh
Technical Reviewer: George Vilches
Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan
Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes, Jeffrey Pepper,
Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom
Welsh
Coordinating Editor: Mary Tobin
Copy Editors: Nancy Sixsmith, Angel Alchin
Compositor: Bytheway Publishing Services
Indexer: John Collin
Cover Designer: Anna Ishchenko
Distributed to the book trade worldwide by Springer Science+Business Media, LLC., 233 Spring Street, 6th
sbm. com , or visit www.springeronline.com .
For information on translations, please e-mail rights@apress.com , or visit www.apress.com .
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use.
eBook versions and licenses are also available for most titles. For more information, reference our Special
Bulk Sales–eBook Licensing web page at www.apress.com/info/bulksales .
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution
has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to
any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly
by the information contained in this work.
The source code for this book is available to readers at www.apress.com . You will need to answer questions
pertaining to this book in order to successfully download the code.
CONTENTS
Contents at a Glance
Contents................................................................................................................. iv
About the Author.................................................................................................. xvi
About the Technical Reviewer ............................................................................ xvii
Acknowledgments ............................................................................................. xviii
Introduction ......................................................................................................... xix
Chapter 1: Principles and Philosophy..................................................................... 1
Chapter 2: Advanced Basics ................................................................................. 19
Chapter 3: Functions............................................................................................. 53
Chapter 4: Classes .............................................................................................. 103
Chapter 5: Common Protocols ............................................................................ 143
Chapter 6: Object Management .......................................................................... 169
Chapter 7: Strings............................................................................................... 191
Chapter 8: Documentation .................................................................................. 207
Chapter 9: Testing............................................................................................... 217
Chapter 10: Distribution ..................................................................................... 233
Chapter 11: Sheets: A CSV Framework............................................................... 243
PEP 8: Style Guide for Python ............................................................................. 283
PEP 10: Voting Guidelines................................................................................... 299
PEP 20: The Zen of Python .................................................................................. 301
PEP 257: Docstring Conventions......................................................................... 303
PEP 387: Backwards Compatibility Policy.......................................................... 309
PEP 3000: Python 3000 ...................................................................................... 313
PEP 3003: Python Language Moratorium ........................................................... 317
Index ................................................................................................................... 321
541071326.008.png
Zgłoś jeśli naruszono regulamin