Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Python 3 Object-Oriented Programming - Second Edition
Python 3 Object-Oriented Programming - Second Edition

Python 3 Object-Oriented Programming - Second Edition: Building robust and maintainable software with object oriented design patterns in Python

Arrow left icon
Profile Icon Dusty Phillips
Arrow right icon
Mex$902.99
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.9 (36 Ratings)
eBook Aug 2015 460 pages 1st Edition
eBook
Mex$902.99
Paperback
Mex$1128.99
Subscription
Free Trial
Arrow left icon
Profile Icon Dusty Phillips
Arrow right icon
Mex$902.99
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.9 (36 Ratings)
eBook Aug 2015 460 pages 1st Edition
eBook
Mex$902.99
Paperback
Mex$1128.99
Subscription
Free Trial
eBook
Mex$902.99
Paperback
Mex$1128.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Python 3 Object-Oriented Programming - Second Edition

Chapter 2. Objects in Python

So, we now have a design in hand and are ready to turn that design into a working program! Of course, it doesn't usually happen this way. We'll be seeing examples and hints for good software design throughout the book, but our focus is object-oriented programming. So, let's have a look at the Python syntax that allows us to create object-oriented software.

After completing this chapter, we will understand:

  • How to create classes and instantiate objects in Python

  • How to add attributes and behaviors to Python objects

  • How to organize classes into packages and modules

  • How to suggest people don't clobber our data

Creating Python classes


We don't have to write much Python code to realize that Python is a very "clean" language. When we want to do something, we just do it, without having to go through a lot of setup. The ubiquitous "hello world" in Python, as you've likely seen, is only one line.

Similarly, the simplest class in Python 3 looks like this:

class MyFirstClass:
    pass

There's our first object-oriented program! The class definition starts with the class keyword. This is followed by a name (of our choice) identifying the class, and is terminated with a colon.

Note

The class name must follow standard Python variable naming rules (it must start with a letter or underscore, and can only be comprised of letters, underscores, or numbers). In addition, the Python style guide (search the web for "PEP 8") recommends that classes should be named using CamelCase notation (start with a capital letter; any subsequent words should also start with a capital).

The class definition line is followed by the class...

Modules and packages


Now, we know how to create classes and instantiate objects, but how do we organize them? For small programs, we can just put all our classes into one file and add a little script at the end of the file to start them interacting. However, as our projects grow, it can become difficult to find the one class that needs to be edited among the many classes we've defined. This is where modules come in. Modules are simply Python files, nothing more. The single file in our small program is a module. Two Python files are two modules. If we have two files in the same folder, we can load a class from one module for use in the other module.

For example, if we are building an e-commerce system, we will likely be storing a lot of data in a database. We can put all the classes and functions related to database access into a separate file (we'll call it something sensible: database.py). Then, our other modules (for example, customer models, product information, and inventory) can import...

Organizing module contents


Inside any one module, we can specify variables, classes, or functions. They can be a handy way to store the global state without namespace conflicts. For example, we have been importing the Database class into various modules and then instantiating it, but it might make more sense to have only one database object globally available from the database module. The database module might look like this:

class Database:
    # the database implementation
    pass

database = Database()

Then we can use any of the import methods we've discussed to access the database object, for example:

from ecommerce.database import database

A problem with the preceding class is that the database object is created immediately when the module is first imported, which is usually when the program starts up. This isn't always ideal since connecting to a database can take a while, slowing down startup, or the database connection information may not yet be available. We could delay creating the...

Who can access my data?


Most object-oriented programming languages have a concept of access control. This is related to abstraction. Some attributes and methods on an object are marked private, meaning only that object can access them. Others are marked protected, meaning only that class and any subclasses have access. The rest are public, meaning any other object is allowed to access them.

Python doesn't do this. Python doesn't really believe in enforcing laws that might someday get in your way. Instead, it provides unenforced guidelines and best practices. Technically, all methods and attributes on a class are publicly available. If we want to suggest that a method should not be used publicly, we can put a note in docstrings indicating that the method is meant for internal use only (preferably, with an explanation of how the public-facing API works!).

By convention, we should also prefix an attribute or method with an underscore character, _. Python programmers will interpret this as "this...

Third-party libraries


Python ships with a lovely standard library, which is a collection of packages and modules that are available on every machine that runs Python. However, you'll soon find that it doesn't contain everything you need. When this happens, you have two options:

  • Write a supporting package yourself

  • Use somebody else's code

We won't be covering the details about turning your packages into libraries, but if you have a problem you need to solve and you don't feel like coding it (the best programmers are extremely lazy and prefer to reuse existing, proven code, rather than write their own), you can probably find the library you want on the Python Package Index (PyPI) at http://pypi.python.org/. Once you've identified a package that you want to install, you can use a tool called pip to install it. However, pip does not come with Python, but Python 3.4 contains a useful tool called ensurepip, which will install it:

python -m ensurepip

This may fail for you on Linux, Mac OS, or other...

Case study


To tie it all together, let's build a simple command-line notebook application. This is a fairly simple task, so we won't be experimenting with multiple packages. We will, however, see common usage of classes, functions, methods, and docstrings.

Let's start with a quick analysis: notes are short memos stored in a notebook. Each note should record the day it was written and can have tags added for easy querying. It should be possible to modify notes. We also need to be able to search for notes. All of these things should be done from the command line.

The obvious object is the Note object; less obvious one is a Notebook container object. Tags and dates also seem to be objects, but we can use dates from Python's standard library and a comma-separated string for tags. To avoid complexity, in the prototype, let's not define separate classes for these objects.

Note objects have attributes for memo itself, tags, and creation_date. Each note will also need a unique integer id so that users...

Exercises


Write some object-oriented code. The goal is to use the principles and syntax you learned in this chapter to ensure you can use it, instead of just reading about it. If you've been working on a Python project, go back over it and see if there are some objects you can create and add properties or methods to. If it's large, try dividing it into a few modules or even packages and play with the syntax.

If you don't have such a project, try starting a new one. It doesn't have to be something you intend to finish, just stub out some basic design parts. You don't need to fully implement everything, often just a print("this method will do something") is all you need to get the overall design in place. This is called top-down design, in which you work out the different interactions and describe how they should work before actually implementing what they do. The converse, bottom-up design, implements details first and then ties them all together. Both patterns are useful at different times...

Summary


In this chapter, we learned how simple it is to create classes and assign properties and methods in Python. Unlike many languages, Python differentiates between a constructor and an initializer. It has a relaxed attitude toward access control. There are many different levels of scope, including packages, modules, classes, and functions. We understood the difference between relative and absolute imports, and how to manage third-party packages that don't come with Python.

In the next chapter, we'll learn how to share implementation using inheritance.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • 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 3

Description

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.  

Who is this book 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 asyncio

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 20, 2015
Length: 460 pages
Edition : 1st
Language : English
ISBN-13 : 9781784395957
Category :
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Aug 20, 2015
Length: 460 pages
Edition : 1st
Language : English
ISBN-13 : 9781784395957
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$12.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 6,500+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$129.99 billed annually
Feature tick icon Unlimited access to Packt's library of 6,500+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts
$179.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 6,500+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Mex$ 3,262.97
Functional Python Programming
Mex$1128.99
Mastering Python Design Patterns
Mex$1004.99
Python 3 Object-Oriented Programming - Second Edition
Mex$1128.99
Total Mex$ 3,262.97 Stars icon
Visually different images

Table of Contents

13 Chapters
Object-oriented Design Chevron down icon Chevron up icon
Objects in Python Chevron down icon Chevron up icon
When Objects Are Alike Chevron down icon Chevron up icon
Expecting the Unexpected Chevron down icon Chevron up icon
When to Use Object-oriented Programming Chevron down icon Chevron up icon
Python Data Structures Chevron down icon Chevron up icon
Python Object-oriented Shortcuts Chevron down icon Chevron up icon
Strings and Serialization Chevron down icon Chevron up icon
The Iterator Pattern Chevron down icon Chevron up icon
Python Design Patterns I Chevron down icon Chevron up icon
Python Design Patterns II Chevron down icon Chevron up icon
Testing Object-oriented Programs Chevron down icon Chevron up icon
Concurrency Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.9
(36 Ratings)
5 star 47.2%
4 star 22.2%
3 star 13.9%
2 star 5.6%
1 star 11.1%
Filter icon Filter
Top Reviews

Filter reviews by




Santhosh Apr 26, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Good book for Object oriented python
Amazon Verified review Amazon
adnan baloch Sep 29, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The title page of the book greets the reader with a photo of idyllic scenery with a mountain in the background. This is not just a photo. This is the place where the readers will find themselves in their minds' eyes once they are done with the book. The book's source code consists of over 200 python source files that are guaranteed to delight beginners and intermediate Python users alike. Happily, the files can be downloaded from the publisher's website for free so go ahead and witness that treasure trove for yourself. The paperback edition of this book is a must have for anyone interested in getting to grips with the object oriented features of Python 3. This second edition has the good fortune of incorporating several years of reader feedback that combines with the author's mature and seasoned grasp of the subject matter to deliver content that is highly relevant to the practical application of Python's power in solving real world computing problems. Data structures, design patterns and unit testing chapters will help the readers stand out for any serious Python development positions. New to this edition is an entire chapter devoted to concurrency that serves as pure icing on the cake especially when you factor in the fact that the world has increasingly shifted to a many-core computing era. Don't be surprised if this voluminous 460 page book turns you into an excellent Python teacher.
Amazon Verified review Amazon
Weston Buckhorn Oct 13, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is laser focused on learning OOP for people who have some programming experience but are stuck in the world of procedural programming. This is perfect for old farts who are addicted to crack-languages like the Basic family of languages. I have included a list of the code you can download below because I want people to buy this book.Ch03\3_01_inheriting_from_object.pyCh03\3_02_simple_contact_class_to_inherit_from.pyCh03\3_03_contact_inherit_supplier.pyCh03\3_04_contact_list_inheritance.pyCh03\3_05_dictionary_long_name.pyCh03\3_06_friend_overrides_init.pyCh03\3_07_friend_overrides_init_super.pyCh03\3_08_send_mail.pyCh03\3_09_send_mail_multi.pyCh03\3_10_friend_address_holder.pyCh03\3_11_friend_multi.pyCh03\3_12_contrived_diamond.pyCh03\3_14_contrived_diamond_super.pyCh03\3_15_friend_multi_super.pyCh03\3_16_polymorphic_audio.pyCh03\3_17.1_abc_container.pyCh03\3_17.2_abc_media.pyCh03\3_17_ducktype_flac.pyCh03\3_18_property.pyCh03\3_19_apartment_ugly_prompt.pyCh03\3_20_validation_function.pyCh03\3_21_apartment_nice_prompt.pyCh03\3_22_house.pyCh03\3_23_purchase_and_rental.pyCh03\3_24_house_rental.pyCh03\3_25_remaining_subclasses.pyCh03\3_26_rudimentary_agent.pyCh03\3_27_type_map.pyCh03\3_28_add_property.pyCh03\final_case_study.pyCh04\04_03_method_calls_excepting.pyCh04\4_01_even_integers.pyCh04\4_02_exception_quits.pyCh04\4_04_try_except.pyCh04\4_05_catch_specific_exception.pyCh04\4_06_catch_multiple_exceptions.pyCh04\4_07_catch_multiple_different.pyCh04\4_08_catch_as_keyword.pyCh04\4_09_finally_and_else.pyCh04\4_10_defining_an_exception.pyCh04\4_11_exception_with_custom_args.pyCh04\4_12_handle_custom_exception.pyCh04\4_13_branching_vs_exceptions.pyCh04\4_14_inventory_mock_object.pyCh04\4_15_inventory_handling.pyCh04\4_16_auth_user.pyCh04\4_17_authenticator.pyCh04\4_18_login.pyCh04\4_19_authorizor.pyCh04\4_20_test_auth.pyCh04\__pycache__\auth.cpython-34.pycCh04\auth.pyCh04\auth.pycCh05\5_01_distances_no_objects.pyCh05\5_02_distances_by_object.pyCh05\5_03_object_polygon_init.pyCh05\5_04_pytho_ugly_as_java.pyCh05\5_05_python_pretty_as_python.pyCh05\5_06_setting_name_in_method.pyCh05\5_07_setting_name_property.pyCh05\5_08_property_arguments.pyCh05\5_09_property_decorator_get.pyCh05\5_11_property_decorator_arguments.pyCh05\5_12_property_decorator_get_set.pyCh05\5_13_read_only_setattr.pyCh05\5_14_read_only_getattribute.pyCh05\5_15_cache_getter.pyCh05\5_16_average_property.pyCh05\5_17_zipsearch.pyCh05\5_18_zipprocessor.pyCh05\5_19_zipreplace_inheritance.pyCh05\5_20_scaleimage_inheritance.pyCh05\5_24_most_basic_document.pyCh05\5_25_document_cursor.pyCh05\5_26_document_using_cursor.pyCh05\5_27_string_property.pyCh05\5_28_Character_class.pyCh05\5_29_document_with_character.pyCh05\Document.pyCh05\zip_processor.pyCh05\zip_processor.pycCh06\6_01_empty_object.pyCh06\6_02_pass_tuple_to_function.pyCh06\6_03_named_tuple.pyCh06\6_04_dict_stocks.pyCh06\6_05_random_key_dict.pyCh06\6_06_setdefault_frequency.pyCh06\6_07_defaultdict_frequency.pyCh06\6_08_defaultdict_custom_function.pyCh06\6_09_counter_frequency.pyCh06\6_09_counter_poll.pyCh06\6_09_list_tuple_frequency.pyCh06\6_10_object_comparison.pyCh06\6_11_song_artist_set.pyCh06\6_12_set_operations.pyCh06\6_13_set_operations2.pyCh06\6_14_oop_pairs.pyCh06\6_15_stupid_adding_integer.pyCh06\6_16_dictsorted.pyCh06\6_17_link_parser.pyCh06\6_18_normalize_url.pyCh06\6_19_visited_links_sets.pyCh06\6_20_collect_remaining_links.pyCh06\6_21_print_collected_links.pyCh06\6_22_dict_link_collector.pyCh06\6_23_queue_link_collector.pyCh06\link_collector.pyCh07\7_01_reversible_objects.pyCh07\7_02_enumerate_line_numbers.pyCh07\7_03.1_zip_to_enumerate.pyCh07\7_03_enumerate_max_min.pyCh07\7_05_read_file.pyCh07\7_05_tdf_processor.pyCh07\7_06_write.pyCh07\7_07_with.pyCh07\7_08_context_manager.pyCh07\7_18_bad_kw_default.pyCh07\7_19_link_downloader.pyCh07\7_20_link_downloader_vararg.pyCh07\7_21_kwarg_options.pyCh07\7_22_all_arguments.pyCh07\7_23_unpacking_arguments.pyCh07\7_24_function_object.pyCh07\7_25_timer.pyCh07\7_26_timer_test.pyCh07\7_27_add_function_to_object.pyCh07\7_28_callable_repeat.pyCh07\7_29_send_email.pyCh07\7_30_send_email_dict_headers.pyCh07\7_32_mailing_list_defaultdict_set.pyCh07\7_33_mailing_list_get_emails.pyCh07\7_34_send_mailing.pyCh07\7_35_load_save.pyCh07\7_36_enter_exit.pyCh07\__pycache__\timer.cpython-34.pycCh07\mailing_list.pyCh07\timer.pyCh07\timer.pycCh08\8_01_string_creation.pyCh08\8_02_format_empty.pyCh08\8_03_format_position.pyCh08\8_04_format_some_positions_broken.pyCh08\8_05_brace_escape.pyCh08\8_06_format_kw_args.pyCh08\8_07_unlabelled_kw.pyCh08\8_08_tuple_dict_format.pyCh08\8_09_tuple_in_dict_format.pyCh08\8_10_object_formatting.pyCh08\8_11_no_format.pyCh08\8_12_currency_format.pyCh08\8_13_tabular.pyCh08\8_14_format_datetime.pyCh08\8_15_encode_bytes.pyCh08\8_16_decode_unicode.pyCh08\8_17_bytearray_replace.pyCh08\8_18_bytearray_index.pyCh08\8_23.1_basic_regex.pyCh08\8_23.2_regex_generic.pyCh08\8_23.3_match_group.pyCh08\8_23_stringio.pyCh08\8_24_basic_pickling.pyCh08\8_25_state_pickling.pyCh08\8_26_json_objects.pyCh08\8_27_template_boilerplate.pyCh08\8_28_template_process.pyCh08\8_29_template_processer_complete.pyCh09\09_08_list_comp_exclude.pyCh09\9_01_iterator.pyCh09\9_06_for_loop_converter.pyCh09\9_07_list_comp_converter.pyCh09\9_09_tdf_list_comp.pyCh09\9_10_set_comprehension.pyCh09\9_11_dict_comprehension.pyCh09\9_13_log_processor.pyCh09\9_14_log_delete_warning_expression.pyCh09\9_15_log_delete_warnings_loop.pyCh09\9_16_log_delete_warnings_object.pyCh09\9_17_log_delete_warnings_generator.pyCh09\9_18_log_delete_warnings_yield_from.pyCh09\9_19_yield_from_filesystem.pyCh09\9_20_basic_count_coroutine.pyCh09\9_21_kernel_log.pyCh09\9_22_load_dataset.pyCh09\9_23_generate_colors.pyCh09\9_24_color_distance.pyCh09\9_25_knearest.pyCh09\9_26_write_results.pyCh09\case_study_machine_learn.pyCh09\kivy_color_checker\main.pyCh09\kivy_color_classifier\main.pyCh10\10_02_simple_socket.pyCh10\10_03_simple_client.pyCh10\10_04_logging_decorator.pyCh10\10_05_gzip_decorator.pyCh10\10_06_calling_decorated_sockets.pyCh10\10_09_logging_decorator.pyCh10\10_10_decorator_syntax.pyCh10\10_11_observer_core.pyCh10\10_12_observer_observing.pyCh10\10_13_strategy_tile.pyCh10\10_15_xml_states.pyCh10\10_16_singleton_using_new.pyCh10\10_17_xml_singletonstates.pyCh10\10_18_create_database_for_template.pyCh10\10_19_template_abstract_noimple.pyCh10\10_20_template_abstract_implemented.pyCh10\10_21_template_concretes.pyCh11\11_01_age_calculator.pyCh11\11_02_age_calculator_adapted.pyCh11\11_03_age_calculator_adapt_date.pyCh11\11_04_email_facade.pyCh11\11_05_flyweight_factory.pyCh11\11_06_flyweight_init.pyCh11\11_07_flyweight_check_serial.pyCh11\11_08_car_class.pyCh11\11_09_window_commands.pyCh11\11_10_window_command_invokers.pyCh11\11_11_window_command_commands.pyCh11\11_12_window_command_function.pyCh11\11_13_document_command_callable.pyCh11\11_14_formatters.pyCh11\11_15_formatter_factories.pyCh11\11_16_composite_folder_methods.pyCh11\11_17_component_hierarchy.pyCh11\11_18_add_child.pyCh12\12_01_simplest_unittest.pyCh12\12_02_assertraises_python.pyCh12\12_03_stats.pyCh12\12_04_test_stats.pyCh12\12_05_skipping_tests.pyCh12\12_06_simplestpytest.pyCh12\12_06_simplestpytest.pycCh12\12_07_class_pytest.pyCh12\12_07_class_pytest.pycCh12\12_08_setup_teardown.pyCh12\12_08_setup_teardown.pycCh12\12_09_funcargs.pyCh12\12_09_funcargs.pycCh12\12_10_funcarg_finalizer.pyCh12\12_10_funcarg_finalizer.pycCh12\12_11_echo_server.pyCh12\12_12_pytest_echo.pyCh12\12_12_pytest_echo.pycCh12\12_13_pytest_simple_skip.pyCh12\12_13_pytest_simple_skip.pycCh12\12_14_pytest_importorskip.pyCh12\12_14_pytest_importorskip.pycCh12\12_15_pytest_skipifmark.pyCh12\12_15_pytest_skipifmark.pycCh12\12_16_mock_flightstatus.pyCh12\12_17_mock_redis.pyCh12\12_30_coverage_unittest.pyCh12\__pycache__\stats.cpython-34.pycCh12\__pycache__\test_mock.cpython-34-PYTEST.pycCh12\casestudy\__pycache__\test_vigenere_cipher.cpython-34-PYTEST.pycCh12\casestudy\__pycache__\vigenere_cipher.cpython-34.pycCh12\casestudy\test_vigenere_cipher.pyCh12\casestudy\test_vigenere_cipher.pycCh12\casestudy\vigenere_cipher.pyCh12\casestudy\vigenere_cipher.pycCh12\casestudy\vigenere_cipher1.pyCh12\stats.pyCh12\stats.pycCh12\test_mock.pyCh13\13_01_two_basic_threads.pyCh13\13_02_thread_wait.pyCh13\13_03_parallel.pyCh13\13_04_prime_factor.pyCh13\13_05_post_search.pyCh13\13_06_futures.pyCh13\13_07_basic_async.pyCh13\13_08_asyncio_dns.pyCh13\13_09_async_multiprocessing.pyCh13\13_10_async_client.pyCh13\case_study\compress_bmp.pyCh13\case_study\decompress_to_bmp.pyThere are no code files present for Chapters 1 and 2.
Amazon Verified review Amazon
Ecki Dec 13, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Das Buch ist für Leser mit Basiskenntnissen in Python geeignet.
Amazon Verified review Amazon
Amazon Customer Sep 12, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Helped with some small issues, great read
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.

Modal Close icon
Modal Close icon