{"id":29538747,"url":"https://github.com/manitreasure1/cpp-for-pythonistas","last_synced_at":"2025-07-31T09:40:23.904Z","repository":{"id":304823638,"uuid":"1020036975","full_name":"manitreasure1/cpp-for-pythonistas","owner":"manitreasure1","description":"Learn C++ the Pythonic way. A beginner-friendly C++ wrapper and course for Python learners — with familiar syntax like print(), input(), and len() to ease the transition.","archived":false,"fork":false,"pushed_at":"2025-07-15T11:41:16.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-16T01:52:49.024Z","etag":null,"topics":["beginner-friendly","cpp","cpp-library","custom-library","data-structures","educational","exceptions","learning-cpp","pycpp","python","pythonic","pythonista","standard-template-library","syntax-wrapper"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manitreasure1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2025-07-15T08:43:45.000Z","updated_at":"2025-07-15T11:46:03.000Z","dependencies_parsed_at":"2025-07-16T04:09:24.632Z","dependency_job_id":"b4281ce6-c83e-465c-ab13-682361578924","html_url":"https://github.com/manitreasure1/cpp-for-pythonistas","commit_stats":null,"previous_names":["manitreasure1/cpp-for-pythonistas"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/manitreasure1/cpp-for-pythonistas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manitreasure1%2Fcpp-for-pythonistas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manitreasure1%2Fcpp-for-pythonistas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manitreasure1%2Fcpp-for-pythonistas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manitreasure1%2Fcpp-for-pythonistas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manitreasure1","download_url":"https://codeload.github.com/manitreasure1/cpp-for-pythonistas/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manitreasure1%2Fcpp-for-pythonistas/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268017357,"owners_count":24181669,"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-07-31T02:00:08.723Z","response_time":66,"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":["beginner-friendly","cpp","cpp-library","custom-library","data-structures","educational","exceptions","learning-cpp","pycpp","python","pythonic","pythonista","standard-template-library","syntax-wrapper"],"created_at":"2025-07-17T05:15:30.446Z","updated_at":"2025-07-31T09:40:23.865Z","avatar_url":"https://github.com/manitreasure1.png","language":"C++","readme":"# 🐍 C++ for Pythonistas\n\n**Write C++ like it's Python.**\n\nThis project brings Python-style syntax, functions, exceptions, and data structures into modern C++. It’s aimed at learners transitioning from Python to C++, or anyone who prefers Python’s readability.\n\n---\n\n## 🔧 What This Project Provides\n\n✅ `pylist\u003cT\u003e` — Python-like list with methods like `append()`, `pop()`, `insert()`, `remove()`  \n✅ `pydict\u003cK, V\u003e` — Python-like dictionary with `get()`, `pop()`, `keys()`, `values()`, `items()`, `clear()`, `copy()`  \n✅ `print()` — C++ wrapper for `std::cout`  \n✅ Python-like constants — `True`, `False`, `None`  \n✅ Custom exceptions with ANSI-colored output — `IndexError`, `KeyError`, `ValueError`, `TypeError`, `ZeroDivisionError`  \n\nAll written in clean, modern C++ with beginner readability in mind.\n\n---\n\n\n\n# 📦 Example: input() and range()\n\n## 🔹 `input(prompt)`\n\n```cpp\n#include \"include/pycpp_io.hpp\"\n\nint main() {\n    std::string name = input(\"What is your name? \");\n    print(\"Hello\", name);\n    return 0;\n}\n```\n\n---\n\n## 🔹 `range(start, stop)` `(or range(stop))`\n\n```cpp\n#include \"include/pycpp_iter.hpp\"  // hypothetical or future header\n\nfor (int i : range(5)) {\n    print(i);  // 0 to 4\n}\n\nfor (int i : range(2, 6)) {\n    print(i);  // 2 to 5\n}\n```\n\n## 📦 Example: `pylist`\n\n```cpp\n#include \"include/pycpp_data_structures.hpp\"\n#include \"include/pycpp_keywords.hpp\"\n\nint main() {\n    pylist\u003cint\u003e nums = {1, 2, 3};\n    nums.append(4);\n    nums.insert(1, 10);\n    nums.remove(3);\n    nums.pop();\n    nums.print();  // Output: [1, 10, 2]\n\n    return 0;\n}\n\n```\n---\n## 📦 Example: `pydict`\n\n```cpp\n#include \"include/pycpp_data_structures.hpp\"\n#include \"include/pycpp_exceptions.hpp\"\n\nint main() {\n    pydict\u003cstd::string, int\u003e ages = {\n        {\"Alice\", 25},\n        {\"Bob\", 30}\n    };\n\n    print(ages.get(\"Bob\"));                    // 30\n    print(ages.get(\"Eve\"));   // throws KeyError            \n    ages.set(\"Charlie\", 22);\n    ages.update({{\"Bob\", 31}});\n    ages.print();  // {\"Alice\": 25, \"Bob\": 31, \"Charlie\": 22}\n\n    for (auto key : ages.keys())\n        print(\"Key:\", key);\n\n    auto age = ages.pop(\"Charlie\");            // Removes and returns 22\n    ages.clear();                              // Empties the dict\n}\n```\n\n## ⚠️ Example: `Python-style Errors`\n\n```cpp\ntry {\n    pylist\u003cint\u003e empty;\n    empty.pop();  // throws IndexError\n} catch (const PyIndexError\u0026 e) {\n    std::cout \u003c\u003c e.what() \u003c\u003c std::endl;\n}\n\ntry {\n    pydict\u003cstd::string, int\u003e d = {{\"x\", 1}};\n    d.get(\"y\");  // throws KeyError\n} catch (const PyKeyError\u0026 e) {\n    std::cout \u003c\u003c e.what() \u003c\u003c std::endl;\n}\n\n```\nOutput:\n```\nIndexError: Pop from empty pylist\nKeyError: key not found in pydict: 'y'\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanitreasure1%2Fcpp-for-pythonistas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanitreasure1%2Fcpp-for-pythonistas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanitreasure1%2Fcpp-for-pythonistas/lists"}