Muutke küpsiste eelistusi

Python Descriptors 1st ed. [Pehme köide]

  • Formaat: Paperback / softback, 64 pages, kõrgus x laius: 235x155 mm, kaal: 1416 g, 4 Illustrations, color; 1 Illustrations, black and white; XV, 64 p. 5 illus., 4 illus. in color., 1 Paperback / softback
  • Ilmumisaeg: 08-Dec-2016
  • Kirjastus: APress
  • ISBN-10: 148422504X
  • ISBN-13: 9781484225042
Teised raamatud teemal:
  • Pehme köide
  • Hind: 23,49 €*
  • * saadame teile pakkumise kasutatud raamatule, mille hind võib erineda kodulehel olevast hinnast
  • See raamat on trükist otsas, kuid me saadame teile pakkumise kasutatud raamatule.
  • Kogus:
  • Lisa ostukorvi
  • Tasuta tarne
  • Lisa soovinimekirja
  • Formaat: Paperback / softback, 64 pages, kõrgus x laius: 235x155 mm, kaal: 1416 g, 4 Illustrations, color; 1 Illustrations, black and white; XV, 64 p. 5 illus., 4 illus. in color., 1 Paperback / softback
  • Ilmumisaeg: 08-Dec-2016
  • Kirjastus: APress
  • ISBN-10: 148422504X
  • ISBN-13: 9781484225042
Teised raamatud teemal:
This short book on Python descriptors is a collection of knowledge and ideas from many sources on dealing with and creating descriptors. And, after going through the things all descriptors have in common, the author explores ideas that have multiple ways of being implemented as well as completely new ideas never seen elsewhere before.

There aren't many good resources out there for writing Python descriptors, and extremely few books. This is a sad state of affairs, as it makes it difficult for Python developers to get a really good understanding of how descriptors work and the techniques to avoid the big gotchas associated with working with them.

This truly is a comprehensive guide to creating Python descriptors. As a BONUS: A pip install-able library, descriptor_tools, was written alongside this book and is an open source library on GitHub.


What you'll learn:

What is a descriptor protocol
What is attribute access and how they apply to descriptors
How to make descriptors and why
Which Methods are needed
How to store attributes
How to do Read-Only Descriptors and Writing _delete()
How to explore the descriptor classes
How to apply the other uses of descriptors and more


Who is this book for:
This book is for experienced Python coders, programmers and developers.


About the Author ix
About the Technical Reviewer xi
Acknowledgments xiii
Introduction xv
Part I About Descriptors
1(22)
Chapter 1 What Is a Descriptor?
3(2)
Data Descriptors vs. Nondata Descriptors
3(1)
The Use of Descriptors by Python
4(1)
Summary
4(1)
Chapter 2 The Descriptor Protocol
5(2)
___get___(self, instance, owner)
5(1)
___set___(self, instance, value)
6(1)
___delete___(self, instance)
6(1)
Summary
6(1)
Chapter 3 What Are Descriptors Good For?
7(2)
Data Encapsulation
7(1)
Reuse of Read/Write Patterns
7(1)
Lazy Instantiation
7(1)
Validation
7(1)
Writing for the Class Level
8(1)
Hiding Function Calls Within Attribute Access
8(1)
Triggering Actions
8(1)
Summary
8(1)
Chapter 4 Descriptors in the Standard Library
9(6)
property
9(2)
classmethod
11(1)
staticmethod
12(1)
Regular Methods
12(1)
Summary
13(2)
Chapter 5 Attribute Access and Descriptors
15(8)
Instance Access
15(3)
Class Access
18(2)
Set and Delete Calls
20(1)
The Reasoning Behind Data vs. Nondata Descriptors
20(1)
Summary
21(2)
Part II Making Descriptors
23(38)
Chapter 6 Which Methods Are Needed?
25(4)
When ___get___() Is Called Without instance
25(1)
Raise Exception or Return self
26(1)
Unbound Attributes
26(2)
Summary
28(1)
Chapter 7 Storing the Attributes
29(12)
Class-Level Storage
29(1)
Storing Data on the Descriptor
30(3)
Storing on the Instance Dictionary
33(2)
Asking for the Location
35(1)
Indirectly Asking for the Location
36(1)
Fetching the Name
37(1)
Keying on the ID
38(1)
Letting the User Take Care of It
39(1)
Metadescriptors
40(1)
Summary
40(1)
Chapter 8 Read-Only Descriptors
41(6)
Set-Once Descriptors
41(1)
Secret-Set Descriptors
42(1)
Forced-Set Descriptors
42(1)
Class Constants
43(2)
Summary
45(2)
Chapter 9 Writing ___delete___()
47(2)
Summary
47(2)
Chapter 10 Descriptors are Classes Too
49(4)
Inheritance
49(1)
More Methods
49(1)
Optional/Default Parameters
50(1)
Descriptors on Descriptors
50(1)
Passing an Instance Around
50(1)
Descriptors Just Abstract Method Calls
50(1)
Summary
51(2)
Chapter 11 Reusing the Wheel
53(6)
Storage Solutions
53(2)
Read-Only Solutions
55(1)
Simple Unbound Attributes
56(1)
Summary
57(2)
Chapter 12 Other Uses of Descriptors in the World
59(2)
SQLAlchemy
59(1)
Jigna
59(1)
Elk
60(1)
Validators
60(1)
Summary
60(1)
Bibliography 61(2)
Index 63
Jacob Zimmerman is a certified Java programmer and a Python and Kotlin enthusiast.