• Complain

Jacob Zimmerman - Python Descriptors: Understanding and Using the Descriptor Protocol

Here you can read online Jacob Zimmerman - Python Descriptors: Understanding and Using the Descriptor Protocol full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2018, publisher: Apress, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Jacob Zimmerman Python Descriptors: Understanding and Using the Descriptor Protocol
  • Book:
    Python Descriptors: Understanding and Using the Descriptor Protocol
  • Author:
  • Publisher:
    Apress
  • Genre:
  • Year:
    2018
  • Rating:
    5 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 100
    • 1
    • 2
    • 3
    • 4
    • 5

Python Descriptors: Understanding and Using the Descriptor Protocol: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Python Descriptors: Understanding and Using the Descriptor Protocol" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Create descriptors and see ideas and examples of how to use descriptors effectively. In this short book, youll explore descriptors in general, with a deep explanation of what descriptors are, how they work, and how theyre used. Once you understand the simplicity of the descriptor protocol, the author delves into using and creating descriptors in practice, with plenty of tips, patterns, and real-world guidance. Because descriptors are inherently flexible, youll work with multiple examples illustrating how to best take advantage of them.
This second edition includes additions throughout, including new material covering the set_name_() descriptors, new and improved flowcharts to explain the inner workings of descriptors, and a completely new chapter to address instance-level attributes, the easiest way to create descriptors correctly the first time.
Although brief, Python Descriptors is a comprehensive guide to creating Python descriptors, including a pip install-able library called descriptor_tools, which was written alongside this book and is an open source library on GitHub. After reading this book, you will have a solid understanding of how descriptors work and the techniques to avoid the big gotchas associated with working with them.
What You Will Learn
Discover descriptor protocols

Master attribute access and how it applies to descriptors

Build your own descriptors

Use descriptors to store attributes

Create read-only descriptors

Explore the descriptor classes

Apply the other uses of descriptors

Who This Book Is For
Experienced Python coders, programmers, and developers.

Jacob Zimmerman: author's other books


Who wrote Python Descriptors: Understanding and Using the Descriptor Protocol? Find out the surname, the name of the author of the book and a list of all author's works by series.

Python Descriptors: Understanding and Using the Descriptor Protocol — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Python Descriptors: Understanding and Using the Descriptor Protocol" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Contents
Landmarks
Jacob Zimmerman Python Descriptors Understanding and Using the Descriptor - photo 1
Jacob Zimmerman
Python Descriptors Understanding and Using the Descriptor Protocol 2nd ed.
Jacob Zimmerman New York USA Any source code or other supplementary material - photo 2
Jacob Zimmerman
New York, USA

Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the books product page, located at www.apress.com/9781484237267 . For more detailed information, please visit http://www.apress.com/source-code .

ISBN 978-1-4842-3726-7 e-ISBN 978-1-4842-3727-4
https://doi.org/10.1007/978-1-4842-3727-4
Library of Congress Control Number: 2018960194
Jacob Zimmerman 2018
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
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.
While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.
Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
Introduction

Python is a remarkable language with many surprisingly powerful features baked into it. Generators, metaclasses, and decorators are some of those, but this book is all about descriptors.

Code Samples

All code samples are written in Python 3, since that is the most recent version, but all the ideas and principles taught in this book apply to Python 2 as well, as long as youre using new style classes.

The Descriptor Tools Library

Written alongside this book was a library, called descriptor-tools, which can be installed with pip. It contains the fruition of a lot of the ideas and helpers to make it easier to implement them all. Its an open source project with a public GitHub repository. 1

Note

Superscript letters like the one at the end of the previous line are in reference to the bibliography at the back of the book, which includes URLs to the referenced site.

Conventions in This Book

When the text mentions class and instance in a general sense, they refer to a class that has a descriptor attribute and to instances of such classes, respectively. All other classes and instances will be referred to more specifically.

New in the 2nd Edition

The 2 nd edition is an update including new features of Python as well as new ideas to learn. One of the new things is incredibly important if this book wants to maintain the status of comprehensive guide that it strives for. This important addition is about the addition of __set_name__() to the descriptor protocol in Python 3.6. You can read about this in Chapter , Storing the Attributes.

Another addition is an idea that was inspired by looking into the __set_name__() addition to the protocol, which youll see just after the section on that addition. Also, I added a chapter on creating instance-level descriptors, which were added to descriptor-tools well before this edition really got started.

The next thing is actually a change, not an addition. Since writing the first book, I found out about the built-in function vars() . Calling vars(obj) is equivalent to obj.__dict__ , but is more Pythonic. Kind of like calling len(obj) instead of obj.__len__() . So the code examples have been updated to use vars() . Any remaining references to __dict__ are purposeful.

Pretty much everything else new in this edition is just cleaning up the language to be more legible.

Acknowledgments

In order to be sure that I got everything rightit would really suck for a comprehensive guide to be missing a big chunk of functionality or to get anything wrongI enlisted the help of some Python experts on the first edition. In return for their help, I let them introduce themselves to you here. Thats not all I did in return, but its all youre going to see:)

Emanuel Barry is a self-taught Python programmer who loves pushing the language to its limits as well as exploring its darkest corners. He has to do a lot of proofreading and editing for a local non-for-profit organization, and decided to combine his love of Python and knowledge sharing with his background in proofreading to help make this book even better. He can often be found in the shadows of the mailing lists or the issue tracker, as well as the Python IRC channel, as Vgr.

Chris Angelico has played around with Python since the late 90s, getting more serious with the language in the mid 2000s. As a PEP Editor and active participant in the various mailing lists, he keeps well up to date with whats new and upcoming in the language and also shares that knowledge with fledgling students in the Thinkful tutoring/mentoring program. When not coding in Python, he is often found wordsmithing for a Dungeons & Dragons campaign, or exploring the linguistic delights of Alice in Wonderland and similar works. If you find a subtle Alice reference in this text, blame him!

https://github.com/Rosuav

Kevin Mackay is a software engineer who has been programming in Python since 2010 and is currently working at BBC, improving the Taster platform. He is enthusiastic about open source software and occasionally contributes to the 3D graphics application, Blender. He can be found on the Python IRC channel as yakca or hiking on a mountain somewhere in Scotland.

Table of Contents
Part I: About Descriptors
Part II: Making Descriptors
About the Author and About the Technical Reviewer
About the Author
Jacob Zimmerman

is a blogger, gamer (tabletop more so than video games), and programmer who was born and raised in Wisconsin. He has a twin brother who could also be considered to have all those traits.

Jacob has his own programming blog that focuses on Java, Kotlin, and Python programming, called Programming Ideas with Jake. He also writes for a gaming blog with his brother-in-law called the Ramblings of Jacob and Delos.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Python Descriptors: Understanding and Using the Descriptor Protocol»

Look at similar books to Python Descriptors: Understanding and Using the Descriptor Protocol. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Python Descriptors: Understanding and Using the Descriptor Protocol»

Discussion, reviews of the book Python Descriptors: Understanding and Using the Descriptor Protocol and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.