Kategorie
Ebooki
-
Biznes i ekonomia
- Bitcoin
- Bizneswoman
- Coaching
- Controlling
- E-biznes
- Ekonomia
- Finanse
- Giełda i inwestycje
- Kompetencje osobiste
- Komputer w biurze
- Komunikacja i negocjacje
- Mała firma
- Marketing
- Motywacja
- Multimedialne szkolenia
- Nieruchomości
- Perswazja i NLP
- Podatki
- Polityka społeczna
- Poradniki
- Prezentacje
- Przywództwo
- Public Relation
- Raporty, analizy
- Sekret
- Social Media
- Sprzedaż
- Start-up
- Twoja kariera
- Zarządzanie
- Zarządzanie projektami
- Zasoby ludzkie (HR)
-
Dla dzieci
-
Dla młodzieży
-
Edukacja
-
Encyklopedie, słowniki
-
E-prasa
- Architektura i wnętrza
- Biznes i Ekonomia
- Dom i ogród
- E-Biznes
- Finanse
- Finanse osobiste
- Firma
- Fotografia
- Informatyka
- Kadry i płace
- Komputery, Excel
- Księgowość
- Kultura i literatura
- Naukowe i akademickie
- Ochrona środowiska
- Opiniotwórcze
- Oświata
- Podatki
- Podróże
- Psychologia
- Religia
- Rolnictwo
- Rynek książki i prasy
- Transport i Spedycja
- Zdrowie i uroda
-
Historia
-
Informatyka
- Aplikacje biurowe
- Bazy danych
- Bioinformatyka
- Biznes IT
- CAD/CAM
- Digital Lifestyle
- DTP
- Elektronika
- Fotografia cyfrowa
- Grafika komputerowa
- Gry
- Hacking
- Hardware
- IT w ekonomii
- Pakiety naukowe
- Podręczniki szkolne
- Podstawy komputera
- Programowanie
- Programowanie mobilne
- Serwery internetowe
- Sieci komputerowe
- Start-up
- Systemy operacyjne
- Sztuczna inteligencja
- Technologia dla dzieci
- Webmasterstwo
-
Inne
-
Języki obce
-
Kultura i sztuka
-
Lektury szkolne
-
Literatura
- Antologie
- Ballada
- Biografie i autobiografie
- Dla dorosłych
- Dramat
- Dzienniki, pamiętniki, listy
- Epos, epopeja
- Esej
- Fantastyka i science-fiction
- Felietony
- Fikcja
- Humor, satyra
- Inne
- Klasyczna
- Kryminał
- Literatura faktu
- Literatura piękna
- Mity i legendy
- Nobliści
- Nowele
- Obyczajowa
- Okultyzm i magia
- Opowiadania
- Pamiętniki
- Podróże
- Poemat
- Poezja
- Polityka
- Popularnonaukowa
- Powieść
- Powieść historyczna
- Proza
- Przygodowa
- Publicystyka
- Reportaż
- Romans i literatura obyczajowa
- Sensacja
- Thriller, Horror
- Wywiady i wspomnienia
-
Nauki przyrodnicze
-
Nauki społeczne
-
Podręczniki szkolne
-
Popularnonaukowe i akademickie
- Archeologia
- Bibliotekoznawstwo
- Filmoznawstwo
- Filologia
- Filologia polska
- Filozofia
- Finanse i bankowość
- Geografia
- Gospodarka
- Handel. Gospodarka światowa
- Historia i archeologia
- Historia sztuki i architektury
- Kulturoznawstwo
- Lingwistyka
- Literaturoznawstwo
- Logistyka
- Matematyka
- Medycyna
- Nauki humanistyczne
- Pedagogika
- Pomoce naukowe
- Popularnonaukowa
- Pozostałe
- Psychologia
- Socjologia
- Teatrologia
- Teologia
- Teorie i nauki ekonomiczne
- Transport i spedycja
- Wychowanie fizyczne
- Zarządzanie i marketing
-
Poradniki
-
Poradniki do gier
-
Poradniki zawodowe i specjalistyczne
-
Prawo
- BHP
- Historia
- Kodeks drogowy. Prawo jazdy
- Nauki prawne
- Ochrona zdrowia
- Ogólne, kompendium wiedzy
- Podręczniki akademickie
- Pozostałe
- Prawo budowlane i lokalowe
- Prawo cywilne
- Prawo finansowe
- Prawo gospodarcze
- Prawo gospodarcze i handlowe
- Prawo karne
- Prawo karne. Przestępstwa karne. Kryminologia
- Prawo międzynarodowe
- Prawo międzynarodowe i zagraniczne
- Prawo ochrony zdrowia
- Prawo oświatowe
- Prawo podatkowe
- Prawo pracy i ubezpieczeń społecznych
- Prawo publiczne, konstytucyjne i administracyjne
- Prawo rodzinne i opiekuńcze
- Prawo rolne
- Prawo socjalne, prawo pracy
- Prawo Unii Europejskiej
- Przemysł
- Rolne i ochrona środowiska
- Słowniki i encyklopedie
- Zamówienia publiczne
- Zarządzanie
-
Przewodniki i podróże
- Afryka
- Albumy
- Ameryka Południowa
- Ameryka Środkowa i Północna
- Australia, Nowa Zelandia, Oceania
- Austria
- Azja
- Bałkany
- Bliski Wschód
- Bułgaria
- Chiny
- Chorwacja
- Czechy
- Dania
- Egipt
- Estonia
- Europa
- Francja
- Góry
- Grecja
- Hiszpania
- Holandia
- Islandia
- Litwa
- Łotwa
- Mapy, Plany miast, Atlasy
- Miniprzewodniki
- Niemcy
- Norwegia
- Podróże aktywne
- Polska
- Portugalia
- Pozostałe
- Rosja
- Rumunia
- Słowacja
- Słowenia
- Szwajcaria
- Szwecja
- Świat
- Turcja
- Ukraina
- Węgry
- Wielka Brytania
- Włochy
-
Psychologia
- Filozofie życiowe
- Kompetencje psychospołeczne
- Komunikacja międzyludzka
- Mindfulness
- Ogólne
- Perswazja i NLP
- Psychologia akademicka
- Psychologia duszy i umysłu
- Psychologia pracy
- Relacje i związki
- Rodzicielstwo i psychologia dziecka
- Rozwiązywanie problemów
- Rozwój intelektualny
- Sekret
- Seksualność
- Uwodzenie
- Wygląd i wizerunek
- Życiowe filozofie
-
Religia
-
Sport, fitness, diety
-
Technika i mechanika
Audiobooki
-
Biznes i ekonomia
- Bitcoin
- Bizneswoman
- Coaching
- Controlling
- E-biznes
- Ekonomia
- Finanse
- Giełda i inwestycje
- Kompetencje osobiste
- Komunikacja i negocjacje
- Mała firma
- Marketing
- Motywacja
- Nieruchomości
- Perswazja i NLP
- Podatki
- Poradniki
- Prezentacje
- Przywództwo
- Public Relation
- Sekret
- Social Media
- Sprzedaż
- Start-up
- Twoja kariera
- Zarządzanie
- Zarządzanie projektami
- Zasoby ludzkie (HR)
-
Dla dzieci
-
Dla młodzieży
-
Edukacja
-
Encyklopedie, słowniki
-
Historia
-
Informatyka
-
Inne
-
Języki obce
-
Kultura i sztuka
-
Lektury szkolne
-
Literatura
- Antologie
- Ballada
- Biografie i autobiografie
- Dla dorosłych
- Dramat
- Dzienniki, pamiętniki, listy
- Epos, epopeja
- Esej
- Fantastyka i science-fiction
- Felietony
- Fikcja
- Humor, satyra
- Inne
- Klasyczna
- Kryminał
- Literatura faktu
- Literatura piękna
- Mity i legendy
- Nobliści
- Nowele
- Obyczajowa
- Okultyzm i magia
- Opowiadania
- Pamiętniki
- Podróże
- Poezja
- Polityka
- Popularnonaukowa
- Powieść
- Powieść historyczna
- Proza
- Przygodowa
- Publicystyka
- Reportaż
- Romans i literatura obyczajowa
- Sensacja
- Thriller, Horror
- Wywiady i wspomnienia
-
Nauki przyrodnicze
-
Nauki społeczne
-
Popularnonaukowe i akademickie
-
Poradniki
-
Poradniki zawodowe i specjalistyczne
-
Prawo
-
Przewodniki i podróże
-
Psychologia
- Filozofie życiowe
- Komunikacja międzyludzka
- Mindfulness
- Ogólne
- Perswazja i NLP
- Psychologia akademicka
- Psychologia duszy i umysłu
- Psychologia pracy
- Relacje i związki
- Rodzicielstwo i psychologia dziecka
- Rozwiązywanie problemów
- Rozwój intelektualny
- Sekret
- Seksualność
- Uwodzenie
- Wygląd i wizerunek
- Życiowe filozofie
-
Religia
-
Sport, fitness, diety
-
Technika i mechanika
Kursy video
-
Bazy danych
-
Big Data
-
Biznes, ekonomia i marketing
-
Cyberbezpieczeństwo
-
Data Science
-
DevOps
-
Dla dzieci
-
Elektronika
-
Grafika/Wideo/CAX
-
Gry
-
Microsoft Office
-
Narzędzia programistyczne
-
Programowanie
-
Rozwój osobisty
-
Sieci komputerowe
-
Systemy operacyjne
-
Testowanie oprogramowania
-
Urządzenia mobilne
-
UX/UI
-
Web development
-
Zarządzanie
Podcasty
- Ebooki
- Programowanie
- Python
- Mastering Object-oriented Python. If you want to master object-oriented Python programming this book is a must-have. With 750 code samples and a relaxed tutorial, it’s a seamless route to programming Python
Szczegóły ebooka
Zaloguj się, jeśli jesteś zainteresowany treścią pozycji.
Mastering Object-oriented Python. If you want to master object-oriented Python programming this book is a must-have. With 750 code samples and a relaxed tutorial, it’s a seamless route to programming Python
Ebook
- Mastering Object-oriented Python
- Table of Contents
- Mastering Object-oriented Python
- Credits
- About the Author
- About the Reviewers
- www.PacktPub.com
- Support files, eBooks, discount offers and more
- Why Subscribe?
- Free Access for Packt account holders
- Support files, eBooks, discount offers and more
- Preface
- What this book covers
- What you need for this book
- Who this book is for
- Conventions
- Reader feedback
- Customer support
- Downloading the example code for this book
- Errata
- Piracy
- Questions
- Some Preliminaries
- About casino Blackjack
- Playing the game
- Blackjack player strategies
- Object design for simulating Blackjack
- Performance the timeit module
- Testing unittest and doctest
- Unit testing and technology spikes
- Docstrings RST markup and documentation tools
- The IDE question
- About special method names
- Summary
- About casino Blackjack
- 1. Pythonic Classes via Special Methods
- Pythonic Classes via Special Methods
- 1. The __init__() Method
- The implicit superclass object
- The base class object __init__() method
- Implementing __init__() in a superclass
- Using __init__() to create manifest constants
- Leveraging __init__() via a factory function
- Faulty factory design and the vague else clause
- Simplicity and consistency using elif sequences
- Simplicity using mapping and class objects
- Two parallel mappings
- Mapping to a tuple of values
- The partial function solution
- Fluent APIs for factories
- Implementing __init__() in each subclass
- Simple composite objects
- Wrapping a collection class
- Extending a collection class
- More requirements and another design
- Complex composite objects
- Complete composite object initialization
- Stateless objects without __init__()
- Some additional class definitions
- Multi-strategy __init__()
- More complex initialization alternatives
- Initializing static methods
- Yet more __init__() techniques
- Initialization with type validation
- Initialization, encapsulation, and privacy
- Summary
- 2. Integrating Seamlessly with Python Basic Special Methods
- The __repr__() and __str__() methods
- Non collection __str__() and __repr__()
- Collection __str__() and __repr__()
- The __format__() method
- Nested formatting specifications
- Collections and delegating format specifications
- The __hash__() method
- Deciding what to hash
- Inheriting definitions for immutable objects
- Overriding definitions for immutable objects
- Overriding definitions for mutable objects
- Making a frozen hand from a mutable hand
- The __bool__() method
- The __bytes__() method
- The comparison operator methods
- Designing comparisons
- Implementation of comparison for objects of the same class
- Implementation of comparison for objects of mixed classes
- Hard totals, soft totals, and polymorphism
- A mixed class comparison example
- The __del__() method
- The reference count and destruction
- Circular references and garbage collection
- Circular references and the weakref module
- The __del__() and close() methods
- The __new__() method and immutable objects
- The __new__() method and metaclasses
- Metaclass example 1 ordered attributes
- Metaclass example 2 self-reference
- Summary
- The __repr__() and __str__() methods
- 3. Attribute Access, Properties, and Descriptors
- Basic attribute processing
- Attributes and the __init__() method
- Creating properties
- Eagerly computed properties
- Setter and deleter properties
- Using special methods for attribute access
- Creating immutable objects with __slots__
- Creating immutable objects as a tuple subclass
- Eagerly computed attributes
- The __getattribute__() method
- Creating descriptors
- Using a nondata descriptor
- Using a data descriptor
- Summary, design considerations, and trade-offs
- Properties versus attributes
- Designing with descriptors
- Looking forward
- Basic attribute processing
- 4. The ABCs of Consistent Design
- Abstract base classes
- Base classes and polymorphism
- Callables
- Containers and collections
- Numbers
- Some additional abstractions
- The iterator abstraction
- Contexts and context managers
- The abc module
- Summary, design considerations, and trade-offs
- Looking forward
- 5. Using Callables and Contexts
- Designing with ABC callables
- Improving performance
- Using memoization or caching
- Using functools for memoization
- Aiming for simplicity using the callable API
- Complexities and the callable API
- Managing contexts and the with statement
- Using the decimal context
- Other contexts
- Defining the __enter__() and __exit__() methods
- Handling exceptions
- Context manager as a factory
- Cleaning up in a context manager
- Summary
- Callable design considerations and trade-offs
- Context manager design considerations and trade-offs
- Looking forward
- 6. Creating Containers and Collections
- ABCs of collections
- Examples of special methods
- Using the standard library extensions
- The namedtuple() function
- The deque class
- The ChainMap use case
- The OrderedDict collection
- The defaultdict subclass
- The counter collection
- Creating new kinds of collections
- Defining a new kind of sequence
- A statistical list
- Choosing eager versus lazy calculation
- Working with __getitem__(), __setitem__(), __delitem__(), and slices
- Implementing __getitem__(), __setitem__(), and __delitem__()
- Wrapping a list and delegating
- Creating iterators with __iter__()
- Creating a new kind of mapping
- Creating a new kind of set
- Some design rationale
- Defining the Tree class
- Defining the TreeNode class
- Demonstrating the binary tree set
- Summary
- Design considerations and Trade-offs
- Looking forward
- 7. Creating Numbers
- ABCs of numbers
- Deciding which types to use
- The method resolution and the reflected operator concept
- The arithmetic operators special methods
- Creating a numeric class
- Defining FixedPoint initialization
- Defining FixedPoint binary arithmetic operators
- Defining FixedPoint unary arithmetic operators
- Implementing FixedPoint reflected operators
- Implementing FixedPoint comparison operators
- Computing a numeric hash
- Designing more useful rounding
- Implementing other special methods
- Optimization with the in-place operators
- Summary
- Design considerations and trade-offs
- Looking forward
- ABCs of numbers
- 8. Decorators and Mixins Cross-cutting Aspects
- Class and meaning
- Constructing the functions
- Constructing the class
- Some class design principles
- Aspect-oriented programming
- Using built-in decorators
- Using standard library decorators
- Using standard library mixin classes
- Using the context manager mixin class
- Turning off a class feature
- Writing a simple function decorator
- Creating separate loggers
- Parameterizing a decorator
- Creating a method function decorator
- Creating a class decorator
- Adding method functions to a class
- Using decorators for security
- Summary
- Design considerations and trade-offs
- Looking forward
- Class and meaning
- 2. Persistence and Serialization
- Persistence and Serialization
- 9. Serializing and Saving JSON, YAML, Pickle, CSV, and XML
- Understanding persistence, class, state, and representation
- Common Python terminologies
- Filesystem and network considerations
- Defining classes to support persistence
- Rendering a blog and posts
- Dumping and loading with JSON
- Supporting JSON in our classes
- Customizing JSON encoding
- Customizing JSON decoding
- The security and the eval() issue
- Refactoring the encode function
- Standardizing the date string
- Writing JSON to a file
- Dumping and loading with YAML
- Formatting YAML data on a file
- Extending the YAML representation
- Security and safe loading
- Dumping and loading with pickle
- Designing a class for reliable pickle processing
- Security and the global issue
- Dumping and loading with CSV
- Dumping simple sequences to CSV
- Loading simple sequences from CSV
- Handling containers and complex classes
- Dumping and loading multiple row types in a CSV file
- Filtering CSV rows with an iterator
- Dumping and loading joined rows in a CSV file
- Dumping and loading with XML
- Dumping objects using string templates
- Dumping objects with xml.etree.ElementTree
- Loading XML documents
- Summary
- Design considerations and trade-offs
- Schema evolution
- Looking forward
- Understanding persistence, class, state, and representation
- 10. Storing and Retrieving Objects via Shelve
- Analyzing persistent object use cases
- The ACID properties
- Creating a shelf
- Designing shelvable objects
- Designing keys for our objects
- Generating surrogate keys for objects
- Designing a class with a simple key
- Designing classes for containers or collections
- Referring to objects via foreign keys
- Designing CRUD operations for complex objects
- Searching, scanning, and querying
- Designing an access layer for shelve
- Writing a demonstration script
- Creating indexes to improve efficiency
- Creating top-level indices
- Adding yet more index maintenance
- The writeback alternative to index updates
- Schema evolution
- Summary
- Design considerations and trade-offs
- Application software layers
- Looking forward
- Analyzing persistent object use cases
- 11. Storing and Retrieving Objects via SQLite
- SQL databases, persistence, and objects
- The SQL data model rows and tables
- CRUD processing via SQL DML statements
- Querying rows with the SQL SELECT statement
- SQL transactions and the ACID properties
- Designing primary and foreign database keys
- Processing application data with SQL
- Implementing class-like processing in pure SQL
- Mapping Python objects to SQLite BLOB columns
- Mapping Python objects to database rows manually
- Designing an access layer for SQLite
- Implementing container relationships
- Improving performance with indices
- Adding an ORM layer
- Designing ORM-friendly classes
- Building the schema with the ORM layer
- Manipulating objects with the ORM layer
- Querying post objects given a tag string
- Improving performance with indices
- Schema evolution
- Summary
- Design considerations and trade-offs
- Mapping alternatives
- Keys and key designs
- Application software layers
- Looking forward
- SQL databases, persistence, and objects
- 12. Transmitting and Sharing Objects
- Class, state, and representation
- Using HTTP and REST to transmit objects
- Implementing CRUD operations via REST
- Implementing non-CRUD operations
- The REST protocol and ACID
- Choosing a representation JSON, XML, or YAML
- Implementing a REST server WSGI and mod_wsgi
- Creating a simple REST application and server
- Implementing a REST client
- Demonstrating and unit testing the RESTful services
- Using Callable classes for WSGI applications
- Designing RESTful object identifiers
- Multiple layers of REST services
- Creating the roulette server
- Creating the roulette client
- Creating a secure REST service
- The WSGI Authentication application
- Implementing REST with a web application framework
- Using a message queue to transmit objects
- Defining processes
- Building queues and supplying data
- Summary
- Design considerations and trade-offs
- Schema evolution
- Application software layers
- Looking forward
- 13. Configuration Files and Persistence
- Configuration file use cases
- Representation, persistence, state, and usability
- Application configuration design patterns
- Configuring via object construction
- Implementing a configuration hierarchy
- Storing the configuration in the INI files
- Handling more literals via the eval() variants
- Storing the configuration in PY files
- Configuration via class definitions
- Configuration via SimpleNamespace
- Using Python with exec() for the configuration
- Why is exec() a nonproblem?
- Using ChainMap for defaults and overrides
- Storing the configuration in JSON or YAML files
- Using flattened JSON configurations
- Loading a YAML configuration
- Storing the configuration in property files
- Parsing a properties file
- Using a properties file
- Storing the configuration in XML files PLIST and others
- Customized XML configuration files
- Summary
- Design considerations and trade-offs
- Creating a shared configuration
- Schema evolution
- Looking Forward
- 3. Testing, Debugging, Deploying, and Maintaining
- Testing, Debugging, Deploying, and Maintaining
- 14. The Logging and Warning Modules
- Creating a basic log
- Creating a shared class-level logger
- Configuring the loggers
- Starting up and shutting down the logging system
- Naming the loggers
- Extending the logger levels
- Defining handlers for multiple destinations
- Managing the propagation rules
- Configuration gotcha
- Specializing logging for control, debug, audit, and security
- Creating a debugging log
- Creating audit and security logs
- Using the warnings module
- Showing API changes with a warning
- Showing configuration problems with a warning
- Showing possible software problems with a warning
- Advanced logging the last few messages and network destinations
- Building an automatic tail buffer
- Sending logging messages to a remote process
- Preventing queue overrun
- Summary
- Design considerations and trade-offs
- Looking forward
- Creating a basic log
- 15. Designing for Testability
- Defining and isolating units for testing
- Minimizing the dependencies
- Creating simple unit tests
- Creating a test suite
- Including edge and corner cases
- Mocking dependencies for testing
- Using more mocks to test more behaviors
- Using doctest to define test cases
- Combining doctest and unittest
- Creating a more complete test package
- Using setup and teardown
- Using setup and teardown with OS resources
- Using setup and teardown with databases
- The TestCase class hierarchy
- Using externally defined expected results
- Automated integration or performance testing
- Summary
- Design considerations and trade-offs
- Looking forward
- Defining and isolating units for testing
- 16. Coping With the Command Line
- The OS interface and the command line
- Arguments and options
- Parsing the command line with argparse
- A simple on/off option
- An option with an argument
- Positional arguments
- All other arguments
- --version display and exit
- --help display and exit
- Integrating command-line options and environment variables
- Providing more configurable defaults
- Overriding configuration file settings with environment variables
- Overriding environment variables with the configuration files
- Making the configuration aware of the None values
- Customizing the help output
- Creating a top-level main() function
- Ensuring DRY for the configuration
- Managing nested configuration contexts
- Programming In The Large
- Designing command classes
- Adding the analysis command subclass
- Adding and packaging more features into an application
- Designing a higher-level composite command
- Additional composite command design patterns
- Integrating with other applications
- Summary
- Design considerations and trade-offs
- Looking forward
- The OS interface and the command line
- 17. The Module and Package Design
- Designing a module
- Some module design patterns
- Module versus class
- The expected content of a module
- Whole module versus module items
- Designing a package
- Designing a module-package hybrid
- Designing a package with alternate implementations
- Designing a main script and the __main__ module
- Creating an executable script file
- Creating a __main__ module
- Programming in the large
- Designing long-running applications
- Organizing code into src, bin, and test
- Installing Python modules
- Summary
- Design considerations and trade-offs
- Looking forward
- Designing a module
- 18. Quality and Documentation
- Writing docstrings for the help() function
- Using pydoc for documentation
- Better output via the RST markup
- Blocks of text
- The RST inline markup
- RST directives
- Learning RST
- Writing effective docstrings
- Writing file-level docstrings, including modules and packages
- Writing API details in RST markup
- Writing class and method function docstrings
- Writing function docstrings
- More sophisticated markup techniques
- Using Sphinx to produce the documentation
- Using the Sphinx quickstart
- Writing the Sphinx documentation
- Filling in the 4+1 views for documentation
- Writing the implementation document
- Creating the Sphinx cross-references
- Refactoring Sphinx files into directories
- Writing the documentation
- Literate programming
- Use cases for literate programming
- Working with a literate programming tool
- Summary
- Design considerations and trade-offs
- Index
- Tytuł: Mastering Object-oriented Python. If you want to master object-oriented Python programming this book is a must-have. With 750 code samples and a relaxed tutorial, it’s a seamless route to programming Python
- Autor: Steven F. Lott
- Tytuł oryginału: Mastering Object-oriented Python. If you want to master object-oriented Python programming this book is a must-have. With 750 code samples and a relaxed tutorial, it’s a seamless route to programming Python.
- ISBN: 9781783280988, 9781783280988
- Data wydania: 2014-04-22
- Format: Ebook
- Identyfikator pozycji: e_3bln
- Wydawca: Packt Publishing