Home > General > Professional Python
29%
Professional Python

Professional Python

          
5
4
3
2
1

Out of Stock


Premium quality
Premium quality
Bookswagon upholds the quality by delivering untarnished books. Quality, services and satisfaction are everything for us!
Easy Return
Easy return
Not satisfied with this product! Keep it in original condition and packaging to avail easy return policy.
Certified product
Certified product
First impression is the last impression! Address the book’s certification page, ISBN, publisher’s name, copyright page and print quality.
Secure Checkout
Secure checkout
Security at its finest! Login, browse, purchase and pay, every step is safe and secured.
Money back guarantee
Money-back guarantee:
It’s all about customers! For any kind of bad experience with the product, get your actual amount back after returning the product.
On time delivery
On-time delivery
At your doorstep on time! Get this book delivered without any delay.
Notify me when this book is in stock
Add to Wishlist

About the Book

Master the secret tools every Python programmer needs to know
Professional Python goes beyond the basics to teach beginner- and intermediate-level Python programmers the little-known tools and constructs that build concise, maintainable code. Design better architecture and write easy-to-understand code using highly adoptable techniques that result in more robust and efficient applications. Coverage includes Decorators, Context Managers, Magic Methods, Class Factories, Metaclasses, Regular Expressions, and more, including advanced methods for unit testing using asyncio and CLI tools. Each topic includes an explanation of the concept and a discussion on applications, followed by hands-on tutorials based on real-world scenarios. All sample code is available for download from the companion website, and the "Python 3 first" approach covers multiple current versions, while ensuring long-term relevance.

Python offers many tools and techniques for writing better code, but often confusing documentation leaves many programmers in the dark about how to use them. This book shines a light on these incredibly useful methods, giving you clear guidance toward building stronger applications.

Learn advanced Python functions, classes, and libraries
Utilize better development and testing tools
Understand the "what," "when," "why," and "how"
Download example code to start programming right away
More than just theory or a recipe-style walk-through, this guide helps you learn — and understand — these little-known tools and techniques. You'll streamline your workflow while improving the quality of your output, producing more robust applications with cleaner code and stronger architecture. If you're ready to take your Python skills to the next level, Professional Python is the invaluable guide that will get you there.

About the Author

Luke Sneeringer is a Python developer living in Austin, TX. He is a regular speaker at PyCon, the largest gathering of Python programmers, and frequently instructs on Python, Ansible, and other topics related to software development and system administration. He currently works for Ansible, Inc., on the Ansible Tower, a comprehensive tool for IT automation.



Table of Contents:
INTRODUCTION PART I: FUNCTIONS CHAPTER 1: DECORATORS Understanding Decorators Decorator Syntax Order of Decorator Application Where Decorators Are Used Why You Should Write Decorators When You Should Write Decorators Additional Functionality Data Sanitization or Addition Function Registration Writing Decorators An Initial Example: A Function Registry Execution-Time Wrapping Code A Simple Type Check Preserving the help User Verification Output Formatting Logging Variable Arguments Decorator Arguments How Does This Work? The Call Signature Matters Decorating Classes Type Switching A Pitfall Summary CHAPTER 2: CONTEXT MANAGERS What Is a Context Manager? Context Manager Syntax The with Statement The enter and exit Methods Exception Handling When You Should Write Context Managers Resource Cleanliness Avoiding Repetition Propagating Exceptions Suppressing Exceptions A Simpler Syntax Summary CHAPTER 3: GENERATORS Understanding What a Generator Is Understanding Generator Syntax The next Function The StopIteration Exception Python 2 Python 3 Communication with Generators Iterables Versus Iterators Generators in the Standard Library range dict.items and Family zip map File Objects When to Write Generators Accessing Data in Pieces Computing Data in Pieces Sequences Can Be Infi nite When Are Generators Singletons? Generators within Generators Summary PART II: CLASSES CHAPTER 4: MAGIC METHODS Magic Method Syntax Available Methods Creation and Destruction __init__ 61 __new__ 62 __del__ 62 Type Conversion 63 __str__, __unicode__, and __bytes__ 63 __bool__ 64 __int__, __fl oat__, and __complex__ 65 Comparisons Binary Equality Relative Comparisons Operator Overloading Overloading Common Methods Collections Other Magic Methods Summary CHAPTER 5: METACLASSES Classes and Objects Using type Directly Creating a Class Creating a Subclass The type Chain The Role of type Writing Metaclasses The new Method new Versus init A Trivial Metaclass Metaclass Inheritance Using Metaclasses Python 3 Python 2 What About Code That Might Run on Either Version? When Is Cross-Compatibility Important? When to Use Metaclasses Declarative Class Declaration An Existing Example How This Works Why This Is a Good Use for Metaclasses Class Verification Non-Inheriting Attributes The Question of Explicit Opt-In Meta-Coding Summary CHAPTER 6: CLASS FACTORIES A Review of type Understanding a Class Factory Function Determining When You Should Write Class Factories Runtime Attributes Understanding Why You Should Do This Attribute Dictionaries Fleshing Out the Credential Class The Form Example Dodging Class Attribute Consistency Class Attributes Versus Instance Attributes The Class Method Limitation Tying This in with Class Factories Answering the Singleton Question Summary CHAPTER 7: ABSTRACT BASE CLASSES Using Abstract Base Classes Declaring a Virtual Subclass Why Declare Virtual Subclasses? Using register as a Decorator __subclasshook__ Declaring a Protocol Other Existing Approaches Using NotImplementedError Using Metaclasses The Value of Abstract Base Classes Abstract Properties Abstract Class or Static Methods Built-in Abstract Base Classes Single-Method ABCs Alternative-Collection ABCs Using Built-In Abstract Base Classes Additional ABCs Summary PART III: DATA CHAPTER 8: STRINGS AND UNICODE Text String Versus Byte String String Data in Python Python 3 Strings Python 2 Strings six Strings with Non-ASCII Characters Observing the Difference Unicode Is a Superset of ASCII Other Encodings Encodings Are Not Cross-Compatible Reading Files Python 3 Specifying Encoding Reading Bytes Python 2 Reading Other Sources Specifying Python File Encodings Strict Codecs Suppressing Errors Registering Error Handlers Summary CHAPTER 9: REGULAR EXPRESSIONS Why Use Regular Expressions? Regular Expressions in Python Raw Strings Match Objects Finding More Than One Match Basic Regular Expressions Character Classes Ranges Negation Shortcuts Beginning and End of String Any Character Optional Characters Repetition Repetition Ranges Open-Ended Ranges Shorthand Grouping The Zero Group Named Groups Referencing Existing Groups Lookahead Flags Case Insensitivity ASCII and Unicode Dot Matching Newline Multiline Mode Verbose Mode Debug Mode Using Multiple Flags Inline Flags Substitution Compiled Regular Expressions Summary PART IV: EVERYTHING ELSE CHAPTER 10: PYTHON 2 VERSUS PYTHON 3 Cross-Compatibility Strategies The __future__ Module 2to3 Writing Changes Limitations six Changes in Python 3 Strings and Unicode The print Function Division Absolute and Relative Imports Removal of "Old-Style" Classes Metaclass Syntax six.with_metaclass six.add_metaclass Exception Syntax Handling Exceptions Exception Chaining Dictionary Methods Function Methods Iterators Standard Library Relocations Merging "Fast" Modules io pickle The URL Modules Renames Other Package Reorganizations Version Detection Summary CHAPTER 11: UNIT TESTING The Testing Continuum The Copied Ecosystem The Isolated Environment Advantages and Disadvantages Speed Interactivity Testing Code Code Layout Testing the Function The assert Statement 1 Unit Testing Frameworks Running Unit Tests Failures Errors Skipped Tests Loading Tests Mocking Mocking a Function Call Asserting Mocked Calls Inspecting Mocks Call Count and Status Multiple Calls Inspecting Calls Other Testing Tools coverage tox Other Test Runners Summary CHAPTER 12: CLI TOOLS optparse A Simple Argument name == ‘ main__' OptionParser Options Types of Options Adding Options to OptionParser Options with Values Non-String Values Specifying Option Values Positional Arguments Counters List Values Why Use optparse? argparse The Bare Bones Arguments and Options 2 Option Flags Alternate Prefi xes Options with Values Positional Arguments Reading Files Why Use argparse? Summary CHAPTER 13: ASYNCIO The Event Loop A Simple Event Loop Running the Loop Registering Tasks and Running the Loop Delaying Calls Partials Running the Loop until a Task Completes Running a Background Loop Coroutines Nested Coroutines Futures and Tasks Futures Tasks Callbacks No Guarantee of Success Under the Hood Callbacks with Arguments Task Aggregation Gathering Tasks Waiting on Tasks Timeouts Waiting on Any Task Waiting on an Exception Queues Maximum Size Servers Summary CHAPTER 14: STYLE Principles Assume Your Code Will Require Maintenance Be Consistent Think About Ontology, Especially with Data Do Not Repeat Yourself Have Your Comments Explain the Story Occam's Razor Standards Trivial Rules Documentation Strings Blank Lines Imports Variables Comments Line Length Summary INDEX


Best Sellers



Product Details
  • ISBN-13: 9788126558957
  • Publisher: Wiley India Pvt Ltd
  • Binding: Paperback
  • No of Pages: 288
  • ISBN-10: 8126558954
  • Publisher Date: 2015
  • Language: English
  • Weight: 500 gr

Related Categories

Similar Products

How would you rate your experience shopping for books on Bookswagon?

Add Photo
Add Photo

Customer Reviews

REVIEWS           
Click Here To Be The First to Review this Product
Professional Python
Wiley India Pvt Ltd -
Professional Python
Writing guidlines
We want to publish your review, so please:
  • keep your review on the product. Review's that defame author's character will be rejected.
  • Keep your review focused on the product.
  • Avoid writing about customer service. contact us instead if you have issue requiring immediate attention.
  • Refrain from mentioning competitors or the specific price you paid for the product.
  • Do not include any personally identifiable information, such as full names.

Professional Python

Required fields are marked with *

Review Title*
Review
    Add Photo Add up to 6 photos
    Would you recommend this product to a friend?
    Tag this Book
    Read more
    Does your review contain spoilers?
    What type of reader best describes you?
    I agree to the terms & conditions
    You may receive emails regarding this submission. Any emails will include the ability to opt-out of future communications.

    CUSTOMER RATINGS AND REVIEWS AND QUESTIONS AND ANSWERS TERMS OF USE

    These Terms of Use govern your conduct associated with the Customer Ratings and Reviews and/or Questions and Answers service offered by Bookswagon (the "CRR Service").


    By submitting any content to Bookswagon, you guarantee that:
    • You are the sole author and owner of the intellectual property rights in the content;
    • All "moral rights" that you may have in such content have been voluntarily waived by you;
    • All content that you post is accurate;
    • You are at least 13 years old;
    • Use of the content you supply does not violate these Terms of Use and will not cause injury to any person or entity.
    You further agree that you may not submit any content:
    • That is known by you to be false, inaccurate or misleading;
    • That infringes any third party's copyright, patent, trademark, trade secret or other proprietary rights or rights of publicity or privacy;
    • That violates any law, statute, ordinance or regulation (including, but not limited to, those governing, consumer protection, unfair competition, anti-discrimination or false advertising);
    • That is, or may reasonably be considered to be, defamatory, libelous, hateful, racially or religiously biased or offensive, unlawfully threatening or unlawfully harassing to any individual, partnership or corporation;
    • For which you were compensated or granted any consideration by any unapproved third party;
    • That includes any information that references other websites, addresses, email addresses, contact information or phone numbers;
    • That contains any computer viruses, worms or other potentially damaging computer programs or files.
    You agree to indemnify and hold Bookswagon (and its officers, directors, agents, subsidiaries, joint ventures, employees and third-party service providers, including but not limited to Bazaarvoice, Inc.), harmless from all claims, demands, and damages (actual and consequential) of every kind and nature, known and unknown including reasonable attorneys' fees, arising out of a breach of your representations and warranties set forth above, or your violation of any law or the rights of a third party.


    For any content that you submit, you grant Bookswagon a perpetual, irrevocable, royalty-free, transferable right and license to use, copy, modify, delete in its entirety, adapt, publish, translate, create derivative works from and/or sell, transfer, and/or distribute such content and/or incorporate such content into any form, medium or technology throughout the world without compensation to you. Additionally,  Bookswagon may transfer or share any personal information that you submit with its third-party service providers, including but not limited to Bazaarvoice, Inc. in accordance with  Privacy Policy


    All content that you submit may be used at Bookswagon's sole discretion. Bookswagon reserves the right to change, condense, withhold publication, remove or delete any content on Bookswagon's website that Bookswagon deems, in its sole discretion, to violate the content guidelines or any other provision of these Terms of Use.  Bookswagon does not guarantee that you will have any recourse through Bookswagon to edit or delete any content you have submitted. Ratings and written comments are generally posted within two to four business days. However, Bookswagon reserves the right to remove or to refuse to post any submission to the extent authorized by law. You acknowledge that you, not Bookswagon, are responsible for the contents of your submission. None of the content that you submit shall be subject to any obligation of confidence on the part of Bookswagon, its agents, subsidiaries, affiliates, partners or third party service providers (including but not limited to Bazaarvoice, Inc.)and their respective directors, officers and employees.

    Accept

    New Arrivals



    Inspired by your browsing history


    Your review has been submitted!

    You've already reviewed this product!