{"id":15685670,"url":"https://github.com/yukinarit/python-cookbook-in-modern-cpp","last_synced_at":"2025-10-13T13:07:25.116Z","repository":{"id":83343183,"uuid":"107853457","full_name":"yukinarit/python-cookbook-in-modern-cpp","owner":"yukinarit","description":"Writing python cookbook in Modern C++ (C++17)","archived":false,"fork":false,"pushed_at":"2018-02-28T14:51:47.000Z","size":2158,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-13T13:05:47.662Z","etag":null,"topics":["cookbook","cpp","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yukinarit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-22T09:38:47.000Z","updated_at":"2025-04-07T19:43:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"e9312ff2-1abc-4b00-b5c6-e7c4bfa0a733","html_url":"https://github.com/yukinarit/python-cookbook-in-modern-cpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yukinarit/python-cookbook-in-modern-cpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinarit%2Fpython-cookbook-in-modern-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinarit%2Fpython-cookbook-in-modern-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinarit%2Fpython-cookbook-in-modern-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinarit%2Fpython-cookbook-in-modern-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yukinarit","download_url":"https://codeload.github.com/yukinarit/python-cookbook-in-modern-cpp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yukinarit%2Fpython-cookbook-in-modern-cpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279015277,"owners_count":26085683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cookbook","cpp","python"],"created_at":"2024-10-03T17:28:39.484Z","updated_at":"2025-10-13T13:07:25.098Z","avatar_url":"https://github.com/yukinarit.png","language":"Python","readme":"python-cookbook-in-modern-cpp\n=============================\n\n[日本語](README_ja.md)\n\nWelcome to python-cookbook-in-modern-cpp repo!\nThis repo is to attempt to write python-cookbook code in modern C++.\n\n## Env\n\nmacOS Sierra / clang 6.0\nCentOS 7.3 / gcc 7.2\n\n## Dependencies\n\n* [range-v3](https://github.com/ericniebler/range-v3)\n  - Lazy evaluation and range algorithims to write python generator like code.\n* [fmt](https://github.com/fmtlib/fmt)\n  - For python like str.format.\n* [date](https://github.com/HowardHinnant/date)\n  - For date calculation.\n* [libzmq](https://github.com/zeromq/libzmq)\n  - For networking.\n* [zmqpp](https://github.com/zeromq/zmqpp)\n  - For networking.\n\n## Build\n\nBuild all\n```bash\ngit clone --recursive https://github.com/yukinarit/python-cookbook-in-modern-cpp.git\ncd python-cookbook-in-modern-cpp\nmkdir build\ncmake ../src\ncd build \u0026\u0026 make\n```\n\nBuild a project\n```bash\ncd src/7/carrying_extra_state_with_callback_functions\nmkdir build\ncmake ..\ncd build \u0026\u0026 make\n```\n\n## Cookbook\n\n| Chapter | Recipe | Description | Code |\n|:-------:|--------|-------------|------|\n| 1 | Determining the Most Frequently Occurring Items in a Sequence | Find an item that has the most occurence in list | [python](src/7/determine_the_top_n_items_occurring_in_a_list/example.py) / [C++](src/7/determine_the_top_n_items_occurring_in_a_list/example.cpp) |\n| 1 | Calculating with Dictionaries | Calculating max/min of item in dictionary | [python](src/1/calculating_with_dictionaries/example.py) / [C++](src/1/calculating_with_dictionaries/example.cpp) |\n| 1 | Filtering Sequence Elements | Appliying various filterings to list | [python](src/1/filtering_list_elements/example.py) / [C++](src/1/filtering_list_elements/example.cpp) |\n| 1 | Finding Commonalities in Two Dictionaries | Calculating intersect from two dictionary | [python](src/1/finding_out_what_two_dictionaries_have_in_common/example.py) / [C++](src/1/finding_out_what_two_dictionaries_have_in_common/example.cpp) |\n| 1 | Finding the Largest or Smallest N Items | Finding the Largest or Smallest N Items from list | [python](src/1/finding_the_largest_or_smallest_n_items/example.py) / [C++](src/1/finding_the_largest_or_smallest_n_items/example.cpp) |\n| 1 | Implementing a Priority Queue | Implementing a Priority Queue | [python](src/1/implementing_a_priority_queue/example.py) / [C++](src/1/implementing_a_priority_queue/example.cpp) |\n| 1 | Keeping the Last N Items | Search a word in a text file and get the last n lines before the mached line | [python](src/1/keeping_the_last_n_items/example.py) / [C++](src/1/keeping_the_last_n_items/example.cpp) |\n| 1 | Mapping Keys to Multiple Values in a Dictionary | Dict manipulation | [python](src/1/mapping_names_to_sequence_elements/example1.py) / [C++](src/1/mapping_names_to_sequence_elements/example.cpp) |\n| 1 | Removing Duplicates from a Sequence while Maintaining Order | Removing duplicates using range algorithm (Generator in Python) | [python](src/1/removing_duplicates_from_a_sequence_while_maintaining_order/example.py) / [C++](src/1/removing_duplicates_from_a_sequence_while_maintaining_order/example.cpp) |\n| 1 | Removing Duplicates from a Sequence while Maintaining Order | WIP | [python](src/1/removing_duplicates_from_a_sequence_while_maintaining_order/example2.py) / [C++]() |\n| 1 | Sorting a List of Dictionaries by a Common Key | Sorting dict by key (Using rambda in C++, itemgetter in python) | [python](src/1/sort_a_list_of_dictionaries_by_a_common_key/example.py) / [C++](src/1/sort_a_list_of_dictionaries_by_a_common_key/example.cpp) |\n| 1 | Sorting Objects Without Native Comparison Support | Sorting Objects Without specifiying a comparison function | [python](src/1/sort_objects_without_native_comparison_support/example.py) / [C++](src/1/sort_objects_without_native_comparison_support/example.cpp) |\n| 2 | Combining and Concatenating Strings | Join and Buffer string | [python](src/2/combining_and_concatenating_strings/example.py) / [C++](src/2/combining_and_concatenating_strings/example.cpp) |\n| 3 | Determining Last Friday’s Date | Date calculation | [python](src/3/determining_last_fridays_date/example.py) / [C++](src/3/determining_last_fridays_date/example.cpp) |\n| 4 | Creating New Iteration Patterns with Generators | Implement range(0, n, step) like function with generator | [python](src/4/creating_new_iteration_patterns_with_generators/example.py) / [C++](src/4/creating_new_iteration_patterns_with_generators/example.cpp) |\n| 4 | Iterating Over the Index-Value Pairs of a Sequence | Implement python's enumerate function | [python](src/4/iterate_over_the_index-value_pairs_of_a_list/example.py) / [C++](src/4/iterate_over_the_index-value_pairs_of_a_list/example.cpp) |\n| 4 | Iterating in Reverse | How to work with iterator | [python](src/4/iterating_in_reverse/example.py) / [C++](src/4/iterating_in_reverse/example.cpp) |\n| 4 | Iterating in Sorted Order Over Merged Sorted Iterables | Merge and sort two collections | [python](src/4/iterating_in_sorted_order_over_merged_sorted_iterables/example.py) / [C++](src/4/iterating_in_sorted_order_over_merged_sorted_iterables/example.cpp) |\n| 4 | Iterating on Items in Separate Containers | Iterate two collections | [python](src/4/iterating_on_items_in_separate_containers/example.py) / [C++](src/4/iterating_on_items_in_separate_containers/example.cpp) |\n| 4 | Delegating Iteration | Iterate childlen | [python](src/4/creating_new_iteration_patterns_with_generators/example.py) / [C++](src/4/creating_new_iteration_patterns_with_generators/example.cpp) |\n| 4 | Defining Generator Functions with Extra State | Implement enumerate like function with state | [python](src/4/generators_with_state/example.py) / [C++](src/4/generators_with_state/example.cpp) |\n| 7 | Carrying Extra State with Callback Functions | Write callback in many ways | [python](src/7/carrying_extra_state_with_callback_functions/example.py) / [C++](src/7/carrying_extra_state_with_callback_functions/example.cpp) |\n| 7 | Writing Functions That Accept Any Number of Arguments | Writing a function that accepts variable number arguments using Variadic template | [python](src/7/functions_that_accept_any_number_of_arguments/example.py) / [C++](src/7/functions_that_accept_any_number_of_arguments/example.cpp) |\n| 7 | Defining Functions with Default Arguments | Pitfall of using mutable type as default argument | [python](src/7/functions_with_default_arguments/example.py) / [C++](src/7/functions_with_default_arguments/example.cpp) |\n| 7 | Making an N-Argument Callable Work As a Callable With Fewer Arguments | An example1 using partial(bind in C++) | [python](src/7/making_an_n-argument_callable_work_as_a_callable_with_fewer_arguments/example1.py) / [C++](src/7/making_an_n-argument_callable_work_as_a_callable_with_fewer_arguments/example1.cpp) |\n| 7 | Making an N-Argument Callable Work As a Callable With Fewer Arguments | An example2 using partial(bind in C++) | [python](src/7/making_an_n-argument_callable_work_as_a_callable_with_fewer_arguments/example2.py) / [C++](src/7/making_an_n-argument_callable_work_as_a_callable_with_fewer_arguments/example2.cpp) |\n| 7 | Making an N-Argument Callable Work As a Callable With Fewer Arguments | An example3 using partial(bind in C++) | [python](src/7/making_an_n-argument_callable_work_as_a_callable_with_fewer_arguments/example3.py) / [C++](src/7/making_an_n-argument_callable_work_as_a_callable_with_fewer_arguments/example3.cpp) |\n| 9 | Applying Decorators to Class and Static Methods | Trying to make decorator-ish macro using variadic template | [python](src/9/applying_decorators_to_class_and_static_methods/example.py) / [C++](src/9/applying_decorators_to_class_and_static_methods/example.cpp) |\n| 11 | Creating a TCP server | Creating a TCP echo client | [python](src/11/creating_a_tcp_server/echoclient.py) / [C++](src/11/creating_a_tcp_server/echoclient.cpp) |\n| 11 | Creating a TCP server | Creating a TCP echo server | [python](src/11/creating_a_tcp_server/echoserv.py) / [C++](src/11/creating_a_tcp_server/echoserv.cpp) |\n| 11 | Creating a TCP server | Creating a TCP echo server using iostream like interface | [python](src/11/creating_a_tcp_server/echoserv2.py) / [C++](src/11/creating_a_tcp_server/echoserv2.cpp) |\n| 11 | Creating a TCP server | Setting option by setsockopt | [python](src/11/creating_a_tcp_server/echoserv3.py) / [C++](src/11/creating_a_tcp_server/echoserv3.cpp) |\n| 12 | Communicating Between Threads | An example using mutex and locks | [python](src/12/how_to_communicate_between_threads/example1.py) / [C++](src/12/how_to_communicate_between_threads/example1.cpp) |\n| 12 | Communicating Between Threads | An example using condition variable | [python](src/12/how_to_communicate_between_threads/example2.py) / [C++](src/12/how_to_communicate_between_threads/example2.cpp) |\n| 12 | How to create thread pool | Creating simple thread pool using lock and condition variable | [python](src/12/how_to_create_a_thread_pool/example1.py) / [C++](src/12/how_to_create_a_thread_pool/example1.cpp) |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyukinarit%2Fpython-cookbook-in-modern-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyukinarit%2Fpython-cookbook-in-modern-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyukinarit%2Fpython-cookbook-in-modern-cpp/lists"}