gitextract_xikm7pk_/ ├── .gitignore ├── .travis.yml ├── Makefile ├── README.md ├── README_en.md ├── cookbook/ │ ├── __init__.py │ ├── c01/ │ │ ├── __init__.py │ │ ├── p03_nitem.py │ │ ├── p04_nlargest.py │ │ ├── p05_priority_queue.py │ │ ├── p06_multidict.py │ │ ├── p07_ordered_dict.py │ │ ├── p08_calculate_dict.py │ │ ├── p09_dict_common.py │ │ ├── p10_remove_duplicate.py │ │ ├── p11_naming_slice.py │ │ ├── p12_mostfreq_items.py │ │ ├── p13_sort_dictlist.py │ │ ├── p14_sort_nocompare.py │ │ ├── p15_group.py │ │ ├── p16_filter.py │ │ ├── p17_subdict.py │ │ ├── p18_nameseq.py │ │ ├── p19_trans_reduce.py │ │ └── p20_combine_map.py │ ├── c02/ │ │ ├── __init__.py │ │ ├── p01_splitstr.py │ │ ├── p02_str_start.py │ │ ├── p03_unix_match.py │ │ ├── p04_match_search.py │ │ ├── p05_search_replace.py │ │ ├── p06_case_insensitive.py │ │ ├── p07_shortest_match.py │ │ ├── p08_multiline_match.py │ │ ├── p09_normal_unicode.py │ │ ├── p10_re_unicode.py │ │ ├── p11_strip.py │ │ ├── p12_translate.py │ │ ├── p13_align_str.py │ │ ├── p14_join_str.py │ │ ├── p15_var_string.py │ │ ├── p16_textwrap.py │ │ ├── p17_html_xml.py │ │ ├── p18_tokenize.py │ │ ├── p19_descent_parser.py │ │ └── p20_byte_str.py │ ├── c03/ │ │ ├── __init__.py │ │ ├── p01_round.py │ │ ├── p02_accurate_decimal.py │ │ ├── p03_format_number.py │ │ ├── p04_bin_octal.py │ │ ├── p05_int_bytes.py │ │ ├── p06_complex.py │ │ ├── p07_inf_nan.py │ │ ├── p08_fraction.py │ │ ├── p09_array_numpy.py │ │ ├── p10_matrix_linear.py │ │ ├── p11_random_num.py │ │ ├── p12_datatime.py │ │ ├── p13_last_friday.py │ │ ├── p14_month_range.py │ │ ├── p15_str_datetime.py │ │ └── p16_timezone.py │ ├── c04/ │ │ ├── __init__.py │ │ ├── p01_manual_iterator.py │ │ ├── p02_delegate_iter.py │ │ ├── p03_generator_pattern.py │ │ ├── p04_iterator_protocol.py │ │ ├── p05_reverse_iterate.py │ │ ├── p06_generator_extrastate.py │ │ ├── p07_iterator_slice.py │ │ ├── p08_skip_iterable.py │ │ ├── p09_iter_permutation.py │ │ ├── p10_iterate_index.py │ │ ├── p11_iterate_simultaneous.py │ │ ├── p12_iterate_separate.py │ │ ├── p13_process_pipline.py │ │ ├── p14_flatten_sequence.py │ │ ├── p15_merge_sorted.py │ │ └── p16_iterate_while.py │ ├── c05/ │ │ ├── __init__.py │ │ ├── p01_rw_text.py │ │ ├── p02_print_tofile.py │ │ ├── p03_print_sepend.py │ │ ├── p04_rw_binary.py │ │ ├── p05_write_notexist.py │ │ ├── p06_string_io.py │ │ ├── p07_gzip_bz2.py │ │ ├── p08_iterate_fixedsize.py │ │ ├── p09_read_tobuffer.py │ │ ├── p10_memery_mapping.py │ │ ├── p11_pathnames.py │ │ ├── p12_file_existence.py │ │ ├── p13_dir_listfile.py │ │ ├── p14_bypass_encode.py │ │ ├── p15_print_badfile.py │ │ ├── p16_change_opencode.py │ │ ├── p17_bytes_tofile.py │ │ ├── p18_file_descriptor.py │ │ ├── p19_temp_file.py │ │ ├── p20_serial_ports.py │ │ └── p21_serialize_object.py │ ├── c06/ │ │ ├── __init__.py │ │ ├── data.json │ │ ├── p01_rw_csv.py │ │ ├── p02_rw_json.py │ │ ├── p03_simple_xml.py │ │ ├── p04_huge_xml.py │ │ ├── p05_dict_toxml.py │ │ ├── p06_rw_xml.py │ │ ├── p07_namespace_xml.py │ │ ├── p08_database.py │ │ ├── p09_codec_hex.py │ │ ├── p10_codec_base64.py │ │ ├── p11_rw_barray.py │ │ ├── p12_var_binary.py │ │ ├── pred.xml │ │ └── stocks.csv │ ├── c07/ │ │ ├── __init__.py │ │ ├── p02_keyarg_only.py │ │ ├── p03_func_annotate.py │ │ ├── p05_default_argument.py │ │ ├── p06_anony_func.py │ │ ├── p08_partial.py │ │ ├── p09_class_to_func.py │ │ ├── p10_callback.py │ │ ├── p11_inline_callback.py │ │ └── p12_closure_access.py │ ├── c08/ │ │ ├── __init__.py │ │ ├── p01_str_represent.py │ │ ├── p02_custom_format.py │ │ ├── p03_context_protocol.py │ │ ├── p04_slots.py │ │ ├── p05_encapsulate_name.py │ │ ├── p06_managed_attribute.py │ │ ├── p07_super_method.py │ │ ├── p08_extend_property.py │ │ ├── p09_descriptor.py │ │ ├── p10_lazy_property.py │ │ ├── p11_simplify_init.py │ │ ├── p12_abstract_interface.py │ │ ├── p13_type_system.py │ │ ├── p14_custom_container.py │ │ ├── p15_delegate_attribute.py │ │ ├── p16_more_constructor.py │ │ ├── p17_without_init.py │ │ ├── p18_mixin_classes.py │ │ ├── p19_stateful_object.py │ │ ├── p20_invoke_bystr.py │ │ ├── p21_vistor_pattern.py │ │ ├── p22_vistor_norecursiion.py │ │ ├── p23_weakref.py │ │ ├── p24_class_compare.py │ │ └── p25_cached_objects.py │ ├── c09/ │ │ ├── __init__.py │ │ ├── p01_wrap_function.py │ │ ├── p02_preserve_metadata.py │ │ ├── p03_unwrap_decorator.py │ │ ├── p04_decorator_argument.py │ │ ├── p05_adjust_attribute.py │ │ ├── p06_optarg_decorator.py │ │ ├── p07_typecheck.py │ │ ├── p08_inclass_decorator.py │ │ ├── p09_class_decorator.py │ │ ├── p10_static_decorator.py │ │ ├── p11_add_argument.py │ │ ├── p12_patch_class.py │ │ ├── p13_instance_create.py │ │ ├── p14_attribute_order.py │ │ ├── p15_meta_optional_arg.py │ │ ├── p16_enforce_args.py │ │ ├── p17_code_convention.py │ │ ├── p18_define_classes.py │ │ ├── p19_define_init.py │ │ ├── p20_multiple_dispatch.py │ │ ├── p21_avoid_repetitive.py │ │ ├── p22_context_manager.py │ │ ├── p23_local_side.py │ │ ├── p24_analyze_source.py │ │ └── p25_disassemble_bytecode.py │ ├── c10/ │ │ ├── __init__.py │ │ ├── p02_control_import.py │ │ └── p12_import_patch.py │ ├── c11/ │ │ ├── p01_.py │ │ ├── p02_.py │ │ ├── p03_.py │ │ ├── p04_.py │ │ ├── p05_.py │ │ ├── p06_.py │ │ ├── p07_.py │ │ ├── p08_.py │ │ ├── p09_.py │ │ ├── p10_.py │ │ ├── p11_.py │ │ ├── p12_.py │ │ └── p13_.py │ ├── c12/ │ │ ├── __init__.py │ │ ├── p01_start_stop_thread.py │ │ ├── p02_.py │ │ ├── p03_.py │ │ ├── p04_.py │ │ ├── p05_.py │ │ ├── p06_.py │ │ ├── p07_.py │ │ ├── p08_.py │ │ ├── p09_.py │ │ ├── p10_.py │ │ ├── p11_.py │ │ ├── p12_.py │ │ ├── p13_.py │ │ └── p14_.py │ ├── c13/ │ │ ├── p01_.py │ │ ├── p02_.py │ │ ├── p03_.py │ │ ├── p04_.py │ │ ├── p05_.py │ │ ├── p06_.py │ │ ├── p07_.py │ │ ├── p08_.py │ │ ├── p09_.py │ │ ├── p10_.py │ │ ├── p11_.py │ │ ├── p12_.py │ │ ├── p13_.py │ │ ├── p14_.py │ │ └── p15_.py │ ├── c14/ │ │ ├── p01_.py │ │ ├── p02_.py │ │ ├── p03_.py │ │ ├── p04_.py │ │ ├── p05_.py │ │ ├── p06_.py │ │ ├── p07_.py │ │ ├── p08_.py │ │ ├── p09_.py │ │ ├── p10_.py │ │ ├── p11_.py │ │ ├── p12_.py │ │ ├── p13_.py │ │ └── p14_.py │ ├── c15/ │ │ ├── p01_.py │ │ ├── p02_.py │ │ ├── p03_.py │ │ ├── p04_.py │ │ ├── p05_.py │ │ ├── p06_.py │ │ ├── p07_.py │ │ ├── p08_.py │ │ ├── p09_.py │ │ ├── p10_.py │ │ ├── p11_.py │ │ ├── p12_.py │ │ ├── p13_.py │ │ ├── p14_.py │ │ ├── p15_.py │ │ ├── p16_.py │ │ ├── p17_.py │ │ ├── p18_.py │ │ ├── p19_.py │ │ ├── p20_.py │ │ └── p21_.py │ └── somefile.txt ├── exts/ │ ├── chinese_search.py │ ├── main.dic │ ├── smallseg.py │ ├── suffix.dic │ └── zh.py ├── make.bat ├── notebook/ │ ├── fetch_cookbook.py │ └── ipynb/ │ ├── 第一章:数据结构和算法/ │ │ ├── p01_unpack_sequence_into_separate_variables.ipynb │ │ ├── p02_unpack_elements_from_iterables.ipynb │ │ ├── p03_keep_last_n_items.ipynb │ │ ├── p04_find_largest_or_smallest_n_items.ipynb │ │ ├── p05_implement_a_priority_queue.ipynb │ │ ├── p06_map_keys_to_multiple_values_in_dict.ipynb │ │ ├── p07_keep_dict_in_order.ipynb │ │ ├── p08_calculating_with_dict.ipynb │ │ ├── p09_find_commonalities_in_dicts.ipynb │ │ ├── p10_remove_duplicates_from_seq_order.ipynb │ │ ├── p11_naming_slice.ipynb │ │ ├── p12_determine_most_freqently_items_in_seq.ipynb │ │ ├── p13_sort_list_of_dicts_by_key.ipynb │ │ ├── p14_sort_objects_without_compare_support.ipynb │ │ ├── p15_group_records_based_on_field.ipynb │ │ ├── p16_filter_sequence_elements.ipynb │ │ ├── p17_extract_subset_of_dict.ipynb │ │ ├── p18_map_names_to_sequence_elements.ipynb │ │ ├── p19_transform_and_reduce_data_same_time.ipynb │ │ └── p20_combine_multiple_map_to_single_map.ipynb │ ├── 第一章:数据结构和算法.ipynb │ ├── 第七章:函数/ │ │ ├── p01_functions_that_accept_any_number_arguments.ipynb │ │ ├── p02_functions_that_only_accept_keyword_arguments.ipynb │ │ ├── p03_attach_informatinal_matadata_to_function_arguments.ipynb │ │ ├── p04_return_multiple_values_from_function.ipynb │ │ ├── p05_define_functions_with_default_arguments.ipynb │ │ ├── p06_define_anonymous_or_inline_functions.ipynb │ │ ├── p07_capturing_variables_in_anonymous_functions.ipynb │ │ ├── p08_make_callable_with_fewer_arguments.ipynb │ │ ├── p09_replace_single_method_classes_with_functions.ipynb │ │ ├── p10_carry_extra_state_with_callback_functions.ipynb │ │ ├── p11_inline_callback_functions.ipynb │ │ └── p12_access_variables_defined_inside_closure.ipynb │ ├── 第七章:函数.ipynb │ ├── 第三章:数字日期和时间/ │ │ ├── p01_round_number.ipynb │ │ ├── p02_accurate_decimal_calculations.ipynb │ │ ├── p03_format_numbers_for_output.ipynb │ │ ├── p04_binary_octal_hexadecimal_int.ipynb │ │ ├── p05_pack_unpack_large_int_from_bytes.ipynb │ │ ├── p06_complex_math.ipynb │ │ ├── p07_infinity_and_nan.ipynb │ │ ├── p08_calculating_with_fractions.ipynb │ │ ├── p09_calculating_with_large_num_arrays.ipynb │ │ ├── p10_matrix_and_linear_algebra_calculation.ipynb │ │ ├── p11_pick_things_at_random.ipynb │ │ ├── p12_convert_days_to_seconds_and_others.ipynb │ │ ├── p13_determine_last_friday_date.ipynb │ │ ├── p14_date_range_for_current_month.ipynb │ │ ├── p15_convert_strings_into_datetimes.ipynb │ │ └── p16_manipulate_dates_involving_timezone.ipynb │ ├── 第三章:数字日期和时间.ipynb │ ├── 第九章:元编程/ │ │ ├── p01_put_wrapper_around_function.ipynb │ │ ├── p02_preserve_function_metadata_when_write_decorators.ipynb │ │ ├── p03_unwrapping_decorator.ipynb │ │ ├── p04_define_decorator_that_takes_arguments.ipynb │ │ ├── p05_define_decorator_with_user_adjustable_attributes.ipynb │ │ ├── p06_define_decorator_that_takes_optional_argument.ipynb │ │ ├── p07_enforcing_type_check_on_function_using_decorator.ipynb │ │ ├── p08_define_decorators_as_part_of_class.ipynb │ │ ├── p09_define_decorators_as_classes.ipynb │ │ ├── p10_apply_decorators_to_class_and_static_methods.ipynb │ │ ├── p11_write_decorators_that_add_arguments_to_functions.ipynb │ │ ├── p12_using_decorators_to_patch_class_definitions.ipynb │ │ ├── p13_using_mataclass_to_control_instance_creation.ipynb │ │ ├── p14_capture_class_attribute_definition_order.ipynb │ │ ├── p15_define_metaclass_that_takes_optional_arguments.ipynb │ │ ├── p16_enforce_argument_signature_on_args_kwargs.ipynb │ │ ├── p17_enforce_coding_conventions_in_classes.ipynb │ │ ├── p18_define_classes_programmatically.ipynb │ │ ├── p19_initializing_class_members_at_definition_time.ipynb │ │ ├── p20_implement_multiple_dispatch_with_function_annotations.ipynb │ │ ├── p21_avoid_repetitive_property_methods.ipynb │ │ ├── p22_define_context_managers_the_easy_way.ipynb │ │ ├── p23_executing_code_with_local_side_effects.ipynb │ │ ├── p24_parse_and_analyzing_python_source.ipynb │ │ └── p25_disassembling_python_byte_code.ipynb │ ├── 第九章:元编程.ipynb │ ├── 第二章:字符串和文本/ │ │ ├── p01_split_string_on_multiple_delimiters.ipynb │ │ ├── p02_match_text_at_start_end.ipynb │ │ ├── p03_match_strings_with_shell_wildcard.ipynb │ │ ├── p04_match_and_search_text.ipynb │ │ ├── p05_search_and_replace_text.ipynb │ │ ├── p06_search_replace_case_insensitive.ipynb │ │ ├── p07_specify_regexp_for_shortest_match.ipynb │ │ ├── p08_regexp_for_multiline_partterns.ipynb │ │ ├── p09_normalize_unicode_text_to_regexp.ipynb │ │ ├── p10_work_with_unicode_in_regexp.ipynb │ │ ├── p11_strip_unwanted_characters.ipynb │ │ ├── p12_sanitizing_clean_up_text.ipynb │ │ ├── p13_aligning_text_strings.ipynb │ │ ├── p14_combine_and_concatenate_strings.ipynb │ │ ├── p15_interpolating_variables_in_strings.ipynb │ │ ├── p16_reformat_text_to_fixed_number_columns.ipynb │ │ ├── p17_handle_html_xml_in_text.ipynb │ │ ├── p18_tokenizing_text.ipynb │ │ ├── p19_writing_recursive_descent_parser.ipynb │ │ └── p20_perform_text_operations_on_byte_string.ipynb │ ├── 第二章:字符串和文本.ipynb │ ├── 第五章:文件与IO/ │ │ ├── p01_read_write_text_data.ipynb │ │ ├── p02_printing_to_file.ipynb │ │ ├── p03_print_with_different_separator_or_line_ending.ipynb │ │ ├── p04_read_write_binary_data.ipynb │ │ ├── p05_write_to_file_not_exist.ipynb │ │ ├── p06_io_operations_on_string.ipynb │ │ ├── p07_read_write_compressed_datafiles.ipynb │ │ ├── p08_iterate_over_fixed_sized_records.ipynb │ │ ├── p09_read_binary_data_into_mutable_buffer.ipynb │ │ ├── p10_memory_mapping_binary_files.ipynb │ │ ├── p11_manipulating_pathnames.ipynb │ │ ├── p12_test_for_the_existence_of_file.ipynb │ │ ├── p13_get_directory_listing.ipynb │ │ ├── p14_bypassing_filename_encoding.ipynb │ │ ├── p15_printing_bad_filenames.ipynb │ │ ├── p16_add_change_encoding_of_already_open_file.ipynb │ │ ├── p17_write_bytes_to_text_file.ipynb │ │ ├── p18_wrap_existing_file_descriptor_as_file_object.ipynb │ │ ├── p19_make_temporary_files_and_directories.ipynb │ │ ├── p20_communicating_with_serial_ports.ipynb │ │ └── p21_serializing_python_objects.ipynb │ ├── 第五章:文件与IO.ipynb │ ├── 第八章:类与对象/ │ │ ├── p01_change_string_representation_of_instances.ipynb │ │ ├── p02_customizing_string_formatting.ipynb │ │ ├── p03_make_objects_support_context_management_protocol.ipynb │ │ ├── p04_save_memory_when_create_large_number_instances.ipynb │ │ ├── p05_encapsulating_names_in_class.ipynb │ │ ├── p06_create_managed_attributes.ipynb │ │ ├── p07_calling_method_on_parent_class.ipynb │ │ ├── p08_extending_property_in_subclass.ipynb │ │ ├── p09_create_new_kind_of_class_or_instance_attribute.ipynb │ │ ├── p10_using_lazily_computed_properties.ipynb │ │ ├── p11_simplify_initialization_of_data_structure.ipynb │ │ ├── p12_define_interface_or_abstract_base_class.ipynb │ │ ├── p13_implementing_data_model_or_type_system.ipynb │ │ ├── p14_implementing_custom_containers.ipynb │ │ ├── p15_delegating_attribute_access.ipynb │ │ ├── p16_define_more_than_one_constructor_in_class.ipynb │ │ ├── p17_create_instance_without_invoking_init_method.ipynb │ │ ├── p18_extending_classes_with_mixins.ipynb │ │ ├── p19_implements_stateful_objects_or_state_machines.ipynb │ │ ├── p20_call_method_on_object_by_string_name.ipynb │ │ ├── p21_implementing_visitor_pattern.ipynb │ │ ├── p22_implementing_visitor_pattern_without_recursion.ipynb │ │ ├── p23_managing_memory_in_cyclic_data_structures.ipynb │ │ ├── p24_making_classes_support_comparison_operations.ipynb │ │ └── p25_creating_cached_instances.ipynb │ ├── 第八章:类与对象.ipynb │ ├── 第六章:数据编码和处理/ │ │ ├── p01_read_write_csv_data.ipynb │ │ ├── p02_read-write_json_data.ipynb │ │ ├── p03_parse_simple_xml_data.ipynb │ │ ├── p04_parse_huge_xml_files_incrementally.ipynb │ │ ├── p05_turning_dictionary_into_xml.ipynb │ │ ├── p06_parse_modify_rewrite_xml.ipynb │ │ ├── p07_parse_xml_documents_with_namespaces.ipynb │ │ ├── p08_interact_with_relational_database.ipynb │ │ ├── p09_decode_encode_hexadecimal_digits.ipynb │ │ ├── p10_decode_encode_base64.ipynb │ │ ├── p11_read_write_binary_arrays_of_structures.ipynb │ │ ├── p12_read_nested_and_variable_sized_binary_structures.ipynb │ │ └── p13_summarizing_and_perform_statistics.ipynb │ ├── 第六章:数据编码和处理.ipynb │ ├── 第十一章:网络与Web编程/ │ │ ├── p01_interact_with_http_services_as_client.ipynb │ │ ├── p02_creating_tcp_server.ipynb │ │ ├── p03_creating_udp_server.ipynb │ │ ├── p04_generate_range_of_ip_addresses_from_cidr_address.ipynb │ │ ├── p05_creating_simple_rest_based_interface.ipynb │ │ ├── p06_implement_simple_remote_procedure_call_with_xml_rpc.ipynb │ │ ├── p07_communicate_simply_between_interpreters.ipynb │ │ ├── p08_implementing_remote_procedure_calls.ipynb │ │ ├── p09_authenticating_clients_simply.ipynb │ │ ├── p10_add_ssl_to_network_services.ipynb │ │ ├── p11_pass_socket_file_descriptor_between_processes.ipynb │ │ ├── p12_understanding_event_driven_io.ipynb │ │ └── p13_sending_receiving_large_arrays.ipynb │ ├── 第十一章:网络与Web编程.ipynb │ ├── 第十三章:脚本编程与系统管理/ │ │ ├── p01_accept_input_via_redirect_pips_or_input_files.ipynb │ │ ├── p02_terminate_program_with_an_error_message.ipynb │ │ ├── p03_parsing_command_line_options.ipynb │ │ ├── p04_prompt_for_password_at_runtime.ipynb │ │ ├── p05_getting_terminal_size.ipynb │ │ ├── p06_executing_external_command_and_get_its_output.ipynb │ │ ├── p07_copy_move_files_and_directories.ipynb │ │ ├── p08_creating_and_unpacking_archives.ipynb │ │ ├── p09_find_files_by_name.ipynb │ │ ├── p10_read_configuration_files.ipynb │ │ ├── p11_add_logging_to_simple_scripts.ipynb │ │ ├── p12_add_logging_to_libraries.ipynb │ │ ├── p13_making_stopwatch_timer.ipynb │ │ ├── p14_putting_limits_on_memory_and_cpu_usage.ipynb │ │ └── p15_luanch_a_web_browser.ipynb │ ├── 第十三章:脚本编程与系统管理.ipynb │ ├── 第十二章:并发编程/ │ │ ├── p01_start_stop_thread.ipynb │ │ ├── p02_determining_if_thread_has_started.ipynb │ │ ├── p03_communicating_between_threads.ipynb │ │ ├── p04_locking_critical_sections.ipynb │ │ ├── p05_locking_with_deadlock_avoidance.ipynb │ │ ├── p06_storing_thread_specific_state.ipynb │ │ ├── p07_creating_thread_pool.ipynb │ │ ├── p08_perform_simple_parallel_programming.ipynb │ │ ├── p09_dealing_with_gil_stop_worring_about_it.ipynb │ │ ├── p10_defining_an_actor_task.ipynb │ │ ├── p11_implement_publish_subscribe_messaging.ipynb │ │ ├── p12_using_generators_as_alternative_to_threads.ipynb │ │ ├── p13_polling_multiple_thread_queues.ipynb │ │ └── p14_launching_daemon_process_on_unix.ipynb │ ├── 第十二章:并发编程.ipynb │ ├── 第十五章:C语言扩展/ │ │ ├── p01_access_ccode_using_ctypes.ipynb │ │ ├── p02_write_simple_c_extension_module.ipynb │ │ ├── p03_write_extension_function_operate_on_arrays.ipynb │ │ ├── p04_manage_opaque_pointers_in_c_extension_modules.ipynb │ │ ├── p05_define_and_export_c_api_from_extension_modules.ipynb │ │ ├── p06_calling_python_from_c.ipynb │ │ ├── p07_release_the_gil_in_c_extensions.ipynb │ │ ├── p08_mix_threads_from_c_and_python.ipynb │ │ ├── p09_wrap_c_code_with_swig.ipynb │ │ ├── p10_wrap_existing_c_code_with_cython.ipynb │ │ ├── p11_use_cython_to_write_high_performance_array_operation.ipynb │ │ ├── p12_turning_function_pointer_into_callable.ipynb │ │ ├── p13_pass_null_terminated_string_to_c_libraries.ipynb │ │ ├── p14_pass_unicode_strings_to_c_libraries.ipynb │ │ ├── p15_converting_c_string_to_python.ipynb │ │ ├── p16_work_with_c_strings_of_dubious_encoding.ipynb │ │ ├── p17_pass_filenames_to_c_extensions.ipynb │ │ ├── p18_pass_open_files_to_c_extensions.ipynb │ │ ├── p19_read_file_like_objects_from_c.ipynb │ │ ├── p20_consuming_an_iterable_from_c.ipynb │ │ └── p21_diagnosing_segmentation_faults.ipynb │ ├── 第十五章:C语言扩展.ipynb │ ├── 第十四章:测试、调试和异常/ │ │ ├── p01_testing_output_sent_to_stdout.ipynb │ │ ├── p02_patching_objects_in_unit_tests.ipynb │ │ ├── p03_testing_for_exceptional_conditions_in_unit_tests.ipynb │ │ ├── p04_logging_test_output_to_file.ipynb │ │ ├── p05_skip_or_anticipate_test_failures.ipynb │ │ ├── p06_handle_multiple_exceptions.ipynb │ │ ├── p07_catching_all_exceptions.ipynb │ │ ├── p08_creating_custom_exceptions.ipynb │ │ ├── p09_raise_exception_in_response_to_another_exception.ipynb │ │ ├── p10_reraising_the_last_exception.ipynb │ │ ├── p11_issuing_warning_messages.ipynb │ │ ├── p12_debugging_basic_program_crashes.ipynb │ │ ├── p13_profiling_and_timing_your_program.ipynb │ │ └── p14_make_your_program_run_faster.ipynb │ ├── 第十四章:测试、调试和异常.ipynb │ ├── 第十章:模块与包/ │ │ ├── p01_make_hierarchical_package_of_modules.ipynb │ │ ├── p02_control_the_import_of_everything.ipynb │ │ ├── p03_import_submodules_by_relative_names.ipynb │ │ ├── p04_split_module_into_multiple_files.ipynb │ │ ├── p05_separate_directories_import_by_namespace.ipynb │ │ ├── p06_reloading_modules.ipynb │ │ ├── p07_make_directory_or_zip_runnable_as_main_script.ipynb │ │ ├── p08_read_datafile_within_package.ipynb │ │ ├── p09_add_directories_to_sys_path.ipynb │ │ ├── p10_import_modules_using_name_given_in_string.ipynb │ │ ├── p11_load_modules_from_remote_machine_by_hooks.ipynb │ │ ├── p12_patching_modules_on_import.ipynb │ │ ├── p13_installing_packages_just_for_yourself.ipynb │ │ ├── p14_creating_new_python_environment.ipynb │ │ └── p15_distributing_packages.ipynb │ ├── 第十章:模块与包.ipynb │ ├── 第四章:迭代器与生成器/ │ │ ├── p01_manually_consuming_iterator.ipynb │ │ ├── p02_delegating_iteration.ipynb │ │ ├── p03_create_new_iteration_with_generators.ipynb │ │ ├── p04_implement_iterator_protocol.ipynb │ │ ├── p05_iterating_in_reverse.ipynb │ │ ├── p06_define_generator_func_with_extra_state.ipynb │ │ ├── p07_taking_slice_of_iterator.ipynb │ │ ├── p08_skip_first_part_of_iterable.ipynb │ │ ├── p09_iterate_over_combination_or_permutation.ipynb │ │ ├── p10_iterate_over_index_value_pairs_of_sequence.ipynb │ │ ├── p11_iterate_over_multiple_sequences_simultaneously.ipynb │ │ ├── p12_iterate_on_items_in_separate_containers.ipynb │ │ ├── p13_create_data_processing_pipelines.ipynb │ │ ├── p14_flattening_nested_sequence.ipynb │ │ ├── p15_iterate_in_sorted_order_over_merged_sorted_iterables.ipynb │ │ └── p16_replace_infinite_while_loops_with_iterator.ipynb │ └── 第四章:迭代器与生成器.ipynb ├── requirements_.txt └── source/ ├── aboutme.rst ├── c01/ │ ├── p01_unpack_sequence_into_separate_variables.rst │ ├── p02_unpack_elements_from_iterables.rst │ ├── p03_keep_last_n_items.rst │ ├── p04_find_largest_or_smallest_n_items.rst │ ├── p05_implement_a_priority_queue.rst │ ├── p06_map_keys_to_multiple_values_in_dict.rst │ ├── p07_keep_dict_in_order.rst │ ├── p08_calculating_with_dict.rst │ ├── p09_find_commonalities_in_dicts.rst │ ├── p10_remove_duplicates_from_seq_order.rst │ ├── p11_naming_slice.rst │ ├── p12_determine_most_freqently_items_in_seq.rst │ ├── p13_sort_list_of_dicts_by_key.rst │ ├── p14_sort_objects_without_compare_support.rst │ ├── p15_group_records_based_on_field.rst │ ├── p16_filter_sequence_elements.rst │ ├── p17_extract_subset_of_dict.rst │ ├── p18_map_names_to_sequence_elements.rst │ ├── p19_transform_and_reduce_data_same_time.rst │ └── p20_combine_multiple_map_to_single_map.rst ├── c02/ │ ├── p01_split_string_on_multiple_delimiters.rst │ ├── p02_match_text_at_start_end.rst │ ├── p03_match_strings_with_shell_wildcard.rst │ ├── p04_match_and_search_text.rst │ ├── p05_search_and_replace_text.rst │ ├── p06_search_replace_case_insensitive.rst │ ├── p07_specify_regexp_for_shortest_match.rst │ ├── p08_regexp_for_multiline_partterns.rst │ ├── p09_normalize_unicode_text_to_regexp.rst │ ├── p10_work_with_unicode_in_regexp.rst │ ├── p11_strip_unwanted_characters.rst │ ├── p12_sanitizing_clean_up_text.rst │ ├── p13_aligning_text_strings.rst │ ├── p14_combine_and_concatenate_strings.rst │ ├── p15_interpolating_variables_in_strings.rst │ ├── p16_reformat_text_to_fixed_number_columns.rst │ ├── p17_handle_html_xml_in_text.rst │ ├── p18_tokenizing_text.rst │ ├── p19_writing_recursive_descent_parser.rst │ └── p20_perform_text_operations_on_byte_string.rst ├── c03/ │ ├── p01_round_number.rst │ ├── p02_accurate_decimal_calculations.rst │ ├── p03_format_numbers_for_output.rst │ ├── p04_binary_octal_hexadecimal_int.rst │ ├── p05_pack_unpack_large_int_from_bytes.rst │ ├── p06_complex_math.rst │ ├── p07_infinity_and_nan.rst │ ├── p08_calculating_with_fractions.rst │ ├── p09_calculating_with_large_num_arrays.rst │ ├── p10_matrix_and_linear_algebra_calculation.rst │ ├── p11_pick_things_at_random.rst │ ├── p12_convert_days_to_seconds_and_others.rst │ ├── p13_determine_last_friday_date.rst │ ├── p14_date_range_for_current_month.rst │ ├── p15_convert_strings_into_datetimes.rst │ └── p16_manipulate_dates_involving_timezone.rst ├── c04/ │ ├── p01_manually_consuming_iterator.rst │ ├── p02_delegating_iteration.rst │ ├── p03_create_new_iteration_with_generators.rst │ ├── p04_implement_iterator_protocol.rst │ ├── p05_iterating_in_reverse.rst │ ├── p06_define_generator_func_with_extra_state.rst │ ├── p07_taking_slice_of_iterator.rst │ ├── p08_skip_first_part_of_iterable.rst │ ├── p09_iterate_over_combination_or_permutation.rst │ ├── p10_iterate_over_index_value_pairs_of_sequence.rst │ ├── p11_iterate_over_multiple_sequences_simultaneously.rst │ ├── p12_iterate_on_items_in_separate_containers.rst │ ├── p13_create_data_processing_pipelines.rst │ ├── p14_flattening_nested_sequence.rst │ ├── p15_iterate_in_sorted_order_over_merged_sorted_iterables.rst │ └── p16_replace_infinite_while_loops_with_iterator.rst ├── c05/ │ ├── p01_read_write_text_data.rst │ ├── p02_printing_to_file.rst │ ├── p03_print_with_different_separator_or_line_ending.rst │ ├── p04_read_write_binary_data.rst │ ├── p05_write_to_file_not_exist.rst │ ├── p06_io_operations_on_string.rst │ ├── p07_read_write_compressed_datafiles.rst │ ├── p08_iterate_over_fixed_sized_records.rst │ ├── p09_read_binary_data_into_mutable_buffer.rst │ ├── p10_memory_mapping_binary_files.rst │ ├── p11_manipulating_pathnames.rst │ ├── p12_test_for_the_existence_of_file.rst │ ├── p13_get_directory_listing.rst │ ├── p14_bypassing_filename_encoding.rst │ ├── p15_printing_bad_filenames.rst │ ├── p16_add_change_encoding_of_already_open_file.rst │ ├── p17_write_bytes_to_text_file.rst │ ├── p18_wrap_existing_file_descriptor_as_file_object.rst │ ├── p19_make_temporary_files_and_directories.rst │ ├── p20_communicating_with_serial_ports.rst │ └── p21_serializing_python_objects.rst ├── c06/ │ ├── p01_read_write_csv_data.rst │ ├── p02_read-write_json_data.rst │ ├── p03_parse_simple_xml_data.rst │ ├── p04_parse_huge_xml_files_incrementally.rst │ ├── p05_turning_dictionary_into_xml.rst │ ├── p06_parse_modify_rewrite_xml.rst │ ├── p07_parse_xml_documents_with_namespaces.rst │ ├── p08_interact_with_relational_database.rst │ ├── p09_decode_encode_hexadecimal_digits.rst │ ├── p10_decode_encode_base64.rst │ ├── p11_read_write_binary_arrays_of_structures.rst │ ├── p12_read_nested_and_variable_sized_binary_structures.rst │ └── p13_summarizing_and_perform_statistics.rst ├── c07/ │ ├── p01_functions_that_accept_any_number_arguments.rst │ ├── p02_functions_that_only_accept_keyword_arguments.rst │ ├── p03_attach_informatinal_matadata_to_function_arguments.rst │ ├── p04_return_multiple_values_from_function.rst │ ├── p05_define_functions_with_default_arguments.rst │ ├── p06_define_anonymous_or_inline_functions.rst │ ├── p07_capturing_variables_in_anonymous_functions.rst │ ├── p08_make_callable_with_fewer_arguments.rst │ ├── p09_replace_single_method_classes_with_functions.rst │ ├── p10_carry_extra_state_with_callback_functions.rst │ ├── p11_inline_callback_functions.rst │ └── p12_access_variables_defined_inside_closure.rst ├── c08/ │ ├── p01_change_string_representation_of_instances.rst │ ├── p02_customizing_string_formatting.rst │ ├── p03_make_objects_support_context_management_protocol.rst │ ├── p04_save_memory_when_create_large_number_instances.rst │ ├── p05_encapsulating_names_in_class.rst │ ├── p06_create_managed_attributes.rst │ ├── p07_calling_method_on_parent_class.rst │ ├── p08_extending_property_in_subclass.rst │ ├── p09_create_new_kind_of_class_or_instance_attribute.rst │ ├── p10_using_lazily_computed_properties.rst │ ├── p11_simplify_initialization_of_data_structure.rst │ ├── p12_define_interface_or_abstract_base_class.rst │ ├── p13_implementing_data_model_or_type_system.rst │ ├── p14_implementing_custom_containers.rst │ ├── p15_delegating_attribute_access.rst │ ├── p16_define_more_than_one_constructor_in_class.rst │ ├── p17_create_instance_without_invoking_init_method.rst │ ├── p18_extending_classes_with_mixins.rst │ ├── p19_implements_stateful_objects_or_state_machines.rst │ ├── p20_call_method_on_object_by_string_name.rst │ ├── p21_implementing_visitor_pattern.rst │ ├── p22_implementing_visitor_pattern_without_recursion.rst │ ├── p23_managing_memory_in_cyclic_data_structures.rst │ ├── p24_making_classes_support_comparison_operations.rst │ └── p25_creating_cached_instances.rst ├── c09/ │ ├── p01_put_wrapper_around_function.rst │ ├── p02_preserve_function_metadata_when_write_decorators.rst │ ├── p03_unwrapping_decorator.rst │ ├── p04_define_decorator_that_takes_arguments.rst │ ├── p05_define_decorator_with_user_adjustable_attributes.rst │ ├── p06_define_decorator_that_takes_optional_argument.rst │ ├── p07_enforcing_type_check_on_function_using_decorator.rst │ ├── p08_define_decorators_as_part_of_class.rst │ ├── p09_define_decorators_as_classes.rst │ ├── p10_apply_decorators_to_class_and_static_methods.rst │ ├── p11_write_decorators_that_add_arguments_to_functions.rst │ ├── p12_using_decorators_to_patch_class_definitions.rst │ ├── p13_using_mataclass_to_control_instance_creation.rst │ ├── p14_capture_class_attribute_definition_order.rst │ ├── p15_define_metaclass_that_takes_optional_arguments.rst │ ├── p16_enforce_argument_signature_on_args_kwargs.rst │ ├── p17_enforce_coding_conventions_in_classes.rst │ ├── p18_define_classes_programmatically.rst │ ├── p19_initializing_class_members_at_definition_time.rst │ ├── p20_implement_multiple_dispatch_with_function_annotations.rst │ ├── p21_avoid_repetitive_property_methods.rst │ ├── p22_define_context_managers_the_easy_way.rst │ ├── p23_executing_code_with_local_side_effects.rst │ ├── p24_parse_and_analyzing_python_source.rst │ └── p25_disassembling_python_byte_code.rst ├── c10/ │ ├── p01_make_hierarchical_package_of_modules.rst │ ├── p02_control_the_import_of_everything.rst │ ├── p03_import_submodules_by_relative_names.rst │ ├── p04_split_module_into_multiple_files.rst │ ├── p05_separate_directories_import_by_namespace.rst │ ├── p06_reloading_modules.rst │ ├── p07_make_directory_or_zip_runnable_as_main_script.rst │ ├── p08_read_datafile_within_package.rst │ ├── p09_add_directories_to_sys_path.rst │ ├── p10_import_modules_using_name_given_in_string.rst │ ├── p11_load_modules_from_remote_machine_by_hooks.rst │ ├── p12_patching_modules_on_import.rst │ ├── p13_installing_packages_just_for_yourself.rst │ ├── p14_creating_new_python_environment.rst │ └── p15_distributing_packages.rst ├── c11/ │ ├── p01_interact_with_http_services_as_client.rst │ ├── p02_creating_tcp_server.rst │ ├── p03_creating_udp_server.rst │ ├── p04_generate_range_of_ip_addresses_from_cidr_address.rst │ ├── p05_creating_simple_rest_based_interface.rst │ ├── p06_implement_simple_remote_procedure_call_with_xml_rpc.rst │ ├── p07_communicate_simply_between_interpreters.rst │ ├── p08_implementing_remote_procedure_calls.rst │ ├── p09_authenticating_clients_simply.rst │ ├── p10_add_ssl_to_network_services.rst │ ├── p11_pass_socket_file_descriptor_between_processes.rst │ ├── p12_understanding_event_driven_io.rst │ └── p13_sending_receiving_large_arrays.rst ├── c12/ │ ├── p01_start_stop_thread.rst │ ├── p02_determining_if_thread_has_started.rst │ ├── p03_communicating_between_threads.rst │ ├── p04_locking_critical_sections.rst │ ├── p05_locking_with_deadlock_avoidance.rst │ ├── p06_storing_thread_specific_state.rst │ ├── p07_creating_thread_pool.rst │ ├── p08_perform_simple_parallel_programming.rst │ ├── p09_dealing_with_gil_stop_worring_about_it.rst │ ├── p10_defining_an_actor_task.rst │ ├── p11_implement_publish_subscribe_messaging.rst │ ├── p12_using_generators_as_alternative_to_threads.rst │ ├── p13_polling_multiple_thread_queues.rst │ └── p14_launching_daemon_process_on_unix.rst ├── c13/ │ ├── p01_accept_input_via_redirect_pips_or_input_files.rst │ ├── p02_terminate_program_with_an_error_message.rst │ ├── p03_parsing_command_line_options.rst │ ├── p04_prompt_for_password_at_runtime.rst │ ├── p05_getting_terminal_size.rst │ ├── p06_executing_external_command_and_get_its_output.rst │ ├── p07_copy_move_files_and_directories.rst │ ├── p08_creating_and_unpacking_archives.rst │ ├── p09_find_files_by_name.rst │ ├── p10_read_configuration_files.rst │ ├── p11_add_logging_to_simple_scripts.rst │ ├── p12_add_logging_to_libraries.rst │ ├── p13_making_stopwatch_timer.rst │ ├── p14_putting_limits_on_memory_and_cpu_usage.rst │ └── p15_luanch_a_web_browser.rst ├── c14/ │ ├── p01_testing_output_sent_to_stdout.rst │ ├── p02_patching_objects_in_unit_tests.rst │ ├── p03_testing_for_exceptional_conditions_in_unit_tests.rst │ ├── p04_logging_test_output_to_file.rst │ ├── p05_skip_or_anticipate_test_failures.rst │ ├── p06_handle_multiple_exceptions.rst │ ├── p07_catching_all_exceptions.rst │ ├── p08_creating_custom_exceptions.rst │ ├── p09_raise_exception_in_response_to_another_exception.rst │ ├── p10_reraising_the_last_exception.rst │ ├── p11_issuing_warning_messages.rst │ ├── p12_debugging_basic_program_crashes.rst │ ├── p13_profiling_and_timing_your_program.rst │ └── p14_make_your_program_run_faster.rst ├── c15/ │ ├── p01_access_ccode_using_ctypes.rst │ ├── p02_write_simple_c_extension_module.rst │ ├── p03_write_extension_function_operate_on_arrays.rst │ ├── p04_manage_opaque_pointers_in_c_extension_modules.rst │ ├── p05_define_and_export_c_api_from_extension_modules.rst │ ├── p06_calling_python_from_c.rst │ ├── p07_release_the_gil_in_c_extensions.rst │ ├── p08_mix_threads_from_c_and_python.rst │ ├── p09_wrap_c_code_with_swig.rst │ ├── p10_wrap_existing_c_code_with_cython.rst │ ├── p11_use_cython_to_write_high_performance_array_operation.rst │ ├── p12_turning_function_pointer_into_callable.rst │ ├── p13_pass_null_terminated_string_to_c_libraries.rst │ ├── p14_pass_unicode_strings_to_c_libraries.rst │ ├── p15_converting_c_string_to_python.rst │ ├── p16_work_with_c_strings_of_dubious_encoding.rst │ ├── p17_pass_filenames_to_c_extensions.rst │ ├── p18_pass_open_files_to_c_extensions.rst │ ├── p19_read_file_like_objects_from_c.rst │ ├── p20_consuming_an_iterable_from_c.rst │ └── p21_diagnosing_segmentation_faults.rst ├── chapters/ │ ├── p01_data_structures_algorithms.rst │ ├── p02_strings_and_text.rst │ ├── p03_numbers_dates_times.rst │ ├── p04_iterators_and_generators.rst │ ├── p05_files_and_io.rst │ ├── p06_data_encoding_and_process.rst │ ├── p07_functions.rst │ ├── p08_classes_and_objects.rst │ ├── p09_meta_programming.rst │ ├── p10_modules_and_packages.rst │ ├── p11_network_and_web_program.rst │ ├── p12_concurrency.rst │ ├── p13_utility_script_and_system_manage.rst │ ├── p14_test_debug_and_exceptions.rst │ ├── p15_c_extensions.rst │ └── p16_appendix.rst ├── conf.py ├── copyright.rst ├── index.rst ├── preface.rst └── roadmap.rst