Python 3 object-oriented programming: unleash the power of Python 3 objects
معرفی کتاب «Python 3 object-oriented programming: unleash the power of Python 3 objects» نوشتهٔ Phillips, Dusty، منتشرشده توسط نشر Packt Publishing Limited در سال 2015. این کتاب در 5 صفحه، فرمت pdf، زبان انگلیسی ارائه شده است. «Python 3 object-oriented programming: unleash the power of Python 3 objects» در دستهٔ بدون دستهبندی قرار دارد.
Rethink Python programming with this guide to Python data structures, design patterns and effective object oriented techniques, to uncover a truly modern Python Cover 1 Copyright 3 Credits 4 About the Author 5 About the Reviewers 6 www.PacktPub.com 9 Introduction tothe second edition 12 Table of Contents 14 Preface 20 Chapter 1: Object-oriented Design 26 Introducing object-oriented 26 Objects and classes 28 Specifying attributes and behaviors 30 Data describes objects 31 Behaviors are actions 32 Hiding details and creating the public interface 34 Composition 36 Inheritance 39 Inheritance provides abstraction 41 Multiple inheritance 42 Case study 43 Exercises 50 Summary 51 Chapter 2: Objects in Python 52 Creating Python classes 52 Adding attributes 54 Making it do something 55 Talking to yourself 55 More arguments 56 Initializing the object 58 Explaining yourself 60 Modules and packages 62 Organizing the modules 65 Absolute imports 65 Relative imports 66 Organizing module contents 68 Who can access my data? 71 Third-party libraries 73 Case study 74 Exercises 83 Summary 83 Chapter 3: When Objects Are Alike 84 Basic inheritance 84 Extending built-ins 87 Overriding and super 88 Multiple inheritance 90 The diamond problem 92 Different sets of arguments 97 Polymorphism 100 Abstract base classes 103 Using an abstract base class 103 Creating an abstract base class 104 Demystifying the magic 106 Case study 107 Exercises 120 Summary 121 Chapter 4: Expecting the Unexpected 122 Raising exceptions 123 Raising an exception 124 The effects of an exception 126 Handling exceptions 127 The Exception hierarchy 133 Defining our own exceptions 134 Case study 139 Exercises 148 Summary 149 Chapter 5: When to Use Object-oriented Programming 150 Treat objects as objects 150 Adding behavior to class data with properties 154 Properties in detail 157 Decorators – another way to create properties 159 Deciding when to use properties 161 Manager objects 163 Removing duplicate code 165 In practice 167 Case study 170 Exercises 178 Summary 179 Chapter 6: Python Data Structures 180 Empty objects 180 Tuples and named tuples 182 Named tuples 184 Dictionaries 185 Dictionary use cases 189 Using defaultdict 189 Counter 191 Lists 192 Sorting lists 194 Sets 198 Extending built-ins 202 Queues 207 FIFO queues 208 LIFO queues 210 Priority queues 211 Case study 213 Exercises 219 Summary 220 Chapter 7: Python Object-oriented Shortcuts 222 Python built-in functions 222 The len() function 223 Reversed 223 Enumerate 225 File I/O 226 Placing it in context 228 An alternative to method overloading 230 Default arguments 231 Variable argument lists 233 Unpacking arguments 237 Functions are objects too 238 Using functions as attributes 242 Callable objects 243 Case study 244 Exercises 251 Summary 252 Chapter 8: Strings and Serialization 254 Strings 254 String manipulation 255 String formatting 257 Escaping braces 258 Keyword arguments 259 Container lookups 260 Object lookups 261 Making it look right 262 Strings are Unicode 264 Converting bytes to text 265 Converting text to bytes 266 Mutable byte strings 268 Regular expressions 269 Matching patterns 270 Matching a selection of characters 271 Escaping characters 272 Matching multiple characters 273 Grouping patterns together 274 Getting information from regular expressions 275 Making repeated regular expressions efficient 277 Serializing objects 277 Customizing pickles 279 Serializing web objects 282 Case study 285 Exercises 290 Summary 292 Chapter 9: The Iterator Pattern 294 Design patterns in brief 294 Iterators 295 The iterator protocol 296 Comprehensions 298 List comprehensions 298 Set and dictionary comprehensions 301 Generator expressions 302 Generators 304 Yield items from another iterable 306 Coroutines 309 Back to log parsing 312 Closing coroutines and throwing exceptions 314 The relationship between coroutines, generators, and functions 315 Case study 316 Exercises 323 Summary 324 Chapter 10: Python Design Patterns I 326 The decorator pattern 326 A decorator example 327 Decorators in Python 330 The observer pattern 332 An observer example 333 The strategy pattern 335 A strategy example 336 Strategy in Python 338 The state pattern 338 A state example 339 State versus strategy 345 State transition as coroutines 345 The singleton pattern 345 Singleton implementation 346 The template pattern 350 A template example 350 Exercises 354 Summary 354 Chapter 11: Python Design Patterns II 356 The adapter pattern 356 The facade pattern 360 The flyweight pattern 362 The command pattern 366 The abstract factory pattern 371 The composite pattern 376 Exercises 380 Summary 381 Chapter 12: Testing Object-oriented Programs 382 Why test? 382 Test-driven development 384 Unit testing 385 Assertion methods 387 Reducing boilerplate and cleaning up 389 Organizing and running tests 390 Ignoring broken tests 391 Testing with py.test 393 One way to do setup and cleanup 395 A completely different way to set up variables 398 Skipping tests with py.test 402 Imitating expensive objects 403 How much testing is enough? 407 Case study 410 Implementing it 411 Exercises 416 Summary 417 Chapter 13: Concurrency 418 Threads 419 The many problems with threads 422 Shared memory 422 The global interpreter lock 423 Thread overhead 424 Multiprocessing 424 Multiprocessing pools 426 Queues 429 The problems with multiprocessing 431 Futures 431 AsyncIO 434 AsyncIO in action 435 Reading an AsyncIO Future 436 AsyncIO for networking 437 Using executors to wrap blocking code 440 Streams 442 Executors 442 Case study 443 Exercises 450 Summary 451 Index 452 www.it-ebooks.info Unleash the power of Python 3 objectsAbout This Book Stop writing scripts and start architecting programs Learn the latest Python syntax and libraries A practical, hands-on tutorial that teaches you all about abstract design patterns and how to implement them in Python 3Who This Book Is For If you're new to object-oriented programming techniques, or if you have basic Python skills and wish to learn in depth how and when to correctly apply object-oriented programming in Python to design software, this is the book for you. What You Will Learn Implement objects in Python by creating classes and defining methods Separate related objects into a taxonomy of classes and describe the properties and behaviors of those objects via the class interface Extend class functionality using inheritance Understand when to use object-oriented features, and more importantly when not to use them Discover what design patterns are and why they are different in Python Uncover the simplicity of unit testing and why it's so important in Python Grasp common concurrency techniques and pitfalls in Python 3 Exploit object-oriented programming in key Python technologies such as Kivy and Django. Object-oriented programming concurrently with asyncioIn Detail Python 3 is more versatile and easier to use than ever. It runs on all major platforms in a huge array of use cases. Coding in Python minimizes development time and increases productivity in comparison to other languages. Clean, maintainable code is easy to both read and write using Python's clear, concise syntax. Object-oriented programming is a popular design paradigm in which data and behaviors are encapsulated in such a way that they can be manipulated together. Many modern programming languages utilize the powerful concepts behind object-oriented programming and Python is no exception. Starting with a detailed analysis of object-oriented analysis and design, you will use the Python programming language to clearly grasp key concepts from the object-oriented paradigm. This book fully explains classes, data encapsulation, inheritance, polymorphism, abstraction, and exceptions with an emphasis on when you can use each principle to develop well-designed software. You'll get an in-depth analysis of many common object-oriented design patterns that are more suitable to Python's unique style. This book will not just teach Python syntax, but will also build your confidence in how to program. You will also learn how to create maintainable applications by studying higher level design patterns. Following this, you'll learn the complexities of string and file manipulation, and how Python distinguishes between binary and textual data. Not one, but two very powerful automated testing systems will be introduced in the book. After you discover the joy of unit testing and just how easy it can be, you'll study higher level libraries such as database connectors and GUI toolkits and learn how they uniquely apply object-oriented principles. You'll learn how these principles will allow you to make greater use of key members of the Python eco-system such as Django and Kivy. This new edition includes all the topics that made Python 3 Object-oriented Programming an instant Packt classic. It's also packed with updated content to reflect recent changes in the core Python library and covers modern third-party packages that were not available on the Python 3 platform when the book was first published. Style and approach Throughout the book you will learn key object-oriented programming techniques demonstrated by comprehensive case studies in the context of a larger project Unleash the power of Python 3 objectsKey FeaturesStop writing scripts and start architecting programsLearn the latest Python syntax and librariesA practical, hands-on tutorial that teaches you all about abstract design patterns and how to implement them in Python 3Book DescriptionPython 3 is more versatile and easier to use than ever. It runs on all major platforms in a huge array of use cases. Coding in Python minimizes development time and increases productivity in comparison to other languages. Clean, maintainable code is easy to both read and write using Python's clear, concise syntax. Object-oriented programming is a popular design paradigm in which data and behaviors are encapsulated in such a way that they can be manipulated together. Many modern programming languages utilize the powerful concepts behind object-oriented programming and Python is no exception. Starting with a detailed analysis of object-oriented analysis and design, you will use the Python programming language to clearly grasp key concepts from the object-oriented paradigm. This book fully explains classes, data encapsulation, inheritance, polymorphism, abstraction, and exceptions with an emphasis on when you can use each principle to develop well-designed software. You'll get an in-depth analysis of many common object-oriented design patterns that are more suitable to Python's unique style. This book will not just teach Python syntax, but will also build your confidence in how to program. You will also learn how to create maintainable applications by studying higher level design patterns. Following this, you'll learn the complexities of string and file manipulation, and how Python distinguishes between binary and textual data. Not one, but two very powerful automated testing systems will be introduced in the book. After you discover the joy of unit testing and just how easy it can be, you'll study higher level libraries such as database connectors and GUI toolkits and learn how they uniquely apply object-oriented principles. You'll learn how these principles will allow you to make greater use of key members of the Python eco-system such as Django and Kivy. This new edition includes all the topics that made Python 3 Object-oriented Programming an instant Packt classic. It's also packed with updated content to reflect recent changes in the core Python library and covers modern third-party packages that were not available on the Python 3 platform when the book was first published. What you will learnImplement objects in Python by creating classes and defining methodsSeparate related objects into a taxonomy of classes and describe the properties and behaviors of those objects via the class interfaceExtend class functionality using inheritanceUnderstand when to use object-oriented features, and more importantly when not to use themDiscover what design patterns are and why they are different in PythonUncover the simplicity of unit testing and why it s so important in PythonGrasp common concurrency techniques and pitfalls in Python 3Exploit object-oriented programming in key Python technologies such as Kivy and Django.Object-oriented programming concurrently with asyncioWho this book is forIf you're new to object-oriented programming techniques, or if you have basic Python skills and wish to learn in depth how and when to correctly apply object-oriented programming in Python to design software, this is the book for you.
دانلود کتاب Python 3 object-oriented programming: unleash the power of Python 3 objects