[{"data":1,"prerenderedAt":282},["ShallowReactive",2],{"tag-labels":3,"site-header":4,"article-python-modules-en":72},{},{"featuredPost":5,"navigations":29},{"id":6,"title":7,"title_id":8,"slug":9,"excerpt":10,"excerpt_id":11,"has_translation":12,"published_at":13,"reading_time":14,"hidden_from_listing":15,"tags":16,"thumbnail_image":21,"og_image":22,"series":23,"authors":28},110,"When You Pick a Framework Just to Look Different","Ketika Pilih Framework Cuma Biar Kelihatan Beda","ketika-pilih-framework-cuma-biar-kelihatan-beda","The last time you chose a new framework or library, was it because your problem needed that tool, or because it sounded cool and few people around you were using it? That question is uncomfortable. Technology decisions are often made for reasons that never appear in any technical document.","Terakhir kali kamu milih framework atau library baru, itu karena masalahmu butuh alat itu, atau karena alatnya kedengaran keren dan belum banyak yang pakai? Pertanyaan ini nggak enak dijawab. Soalnya keputusan teknologi sering diambil dengan alasan yang nggak pernah ditulis di dokumen teknis mana pun.",true,"2026-10-06T15:25:21.000Z",5,false,[17,18,19,20],"karier","framework","opini","pengalaman",null,"\u002Fog\u002Fketika-pilih-framework-cuma-biar-kelihatan-beda.png",{"id":24,"title":25,"title_id":26,"slug":27},9,"Articles","Artikel","all",[],[30,46,67],{"collection":31,"item":32},"series",{"__typename":31,"title":25,"title_id":26,"slug":27,"children_series":33},[34,38,42],{"title":35,"title_id":36,"slug":37},"Artificial Intelligence","Kecerdasan Artifisial","kecerdasan-artifisial",{"title":39,"title_id":40,"slug":41},"Programming Fundamentals","Konsep Dasar Pemrograman","konsep-dasar-pemrograman",{"title":43,"title_id":44,"slug":45},"Algorithms and Data Structures","Algoritma dan Struktur Data","algoritma-struktur-data",{"collection":31,"item":47},{"__typename":31,"title":48,"title_id":48,"slug":49,"children_series":50},"Tutorial","tutorial",[51,55,59,63],{"title":52,"title_id":53,"slug":54},"Learning Python","Belajar Python","belajar-python",{"title":56,"title_id":57,"slug":58},"Learning Go","Belajar Golang","belajar-golang",{"title":60,"title_id":61,"slug":62},"Learning Java","Belajar Java","belajar-java",{"title":64,"title_id":65,"slug":66},"Learning Pascal","Belajar Pascal","belajar-pascal",{"collection":31,"item":68},{"__typename":31,"title":69,"title_id":69,"slug":70,"children_series":71},"Lab","lab",[],{"article":73,"renderedBody":175,"renderedTakeaway":176,"latestArticles":177,"toc":262},{"id":74,"title":75,"title_id":76,"slug":77,"excerpt":78,"excerpt_id":79,"has_translation":12,"published_at":80,"reading_time":81,"hidden_from_listing":15,"tags":82,"thumbnail_image":21,"og_image":85,"series":86,"authors":167,"seoTitle":21,"seoDescription":21,"body_locale":170,"available_locales":171,"body":173,"takeway":174,"prerequisite":21},136,"Python Modules: the Import That Printed the Report","Modul Python: Import yang Mencetak Laporannya","python-modules","You pull one function out into its own file, import it, and the whole report runs again and eats your input. A module is a file, `import` runs it top to bottom, and one line decides which of the two jobs it is doing.","Kamu memindahkan satu fungsi ke file sendiri, meng-import-nya, dan seluruh laporan jalan lagi lalu memakan inputmu. Modul adalah file, `import` menjalankannya dari atas ke bawah, dan satu baris menentukan pekerjaan mana yang sedang dijalankan file itu.","2026-11-06T01:00:00.000Z",7,[83,84],"python","modules","\u002Fog\u002Fpython-modules.png",{"id":87,"title":88,"title_id":89,"slug":90,"description":91,"description_id":92,"articles":93,"children_series":136,"parent_series":137},18,"Working with Python Scripts","Menggunakan Script Python","python-pemrograman-dengan-script","Leave the interpreter and start writing real .py files, including how to take input and print output.","Keluar dari interpreter dan mulai nulis file .py sendiri, lengkap dengan cara mengambil input dan menampilkan output.",[94,115,131],{"id":95,"title":96,"title_id":97,"slug":98,"excerpt":99,"excerpt_id":100,"has_translation":12,"published_at":101,"reading_time":102,"hidden_from_listing":15,"tags":103,"thumbnail_image":21,"og_image":106,"series":107,"authors":108},90,"Writing and Running a Python Script","Menulis dan Menjalankan Script Python","menulis-dan-menjalankan-script-python","A Python script is a file holding Python code, and it usually carries the .py extension.","Script python merupakan file berisi kode dengan bahasa Python yang biasanya memiliki ekstensi .py","2021-03-21T14:49:24.000Z",4,[83,49,104,105],"tooling","cli","\u002Fog\u002Fmenulis-dan-menjalankan-script-python.png",{"id":87,"title":88,"title_id":89,"slug":90},[109],{"authors_id":110},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},1,"Daffa Izzuddin","izzudd","Writer",{"id":116,"title":117,"title_id":118,"slug":119,"excerpt":120,"excerpt_id":121,"has_translation":12,"published_at":122,"reading_time":102,"hidden_from_listing":15,"tags":123,"thumbnail_image":21,"og_image":126,"series":127,"authors":128},91,"Input and Output Systems in Python 3","Sistem Input dan Output pada Python 3","sistem-input-dan-output-pada-python-3","A few functions, print() and input() among them, are the standard tools most I\u002FO work in Python is built on.","Beberapa fungsi seperti print() dan input(), merupakan fungsi standar yang banyak digunakan untuk melakukan I\u002FO.","2021-05-19T14:57:25.000Z",[83,124,125],"input-output","dasar","\u002Fog\u002Fsistem-input-dan-output-pada-python-3.png",{"id":87,"title":88,"title_id":89,"slug":90},[129],{"authors_id":130},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":74,"title":75,"title_id":76,"slug":77,"excerpt":78,"excerpt_id":79,"has_translation":12,"published_at":80,"reading_time":81,"hidden_from_listing":15,"tags":82,"thumbnail_image":21,"og_image":85,"series":132,"authors":133},{"id":87,"title":88,"title_id":89,"slug":90},[134],{"authors_id":135},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},[],{"id":138,"title":52,"title_id":53,"slug":54,"parent_series":139,"children_series":140},10,{"id":111,"title":48,"title_id":48,"slug":49},[141,146,151,152,157,162],{"id":142,"title":143,"title_id":144,"slug":145,"cover_image":21},16,"Getting Started with Python","Berkenalan dengan Bahasa Python","python-intro",{"id":147,"title":148,"title_id":149,"slug":150,"cover_image":21},17,"Variables, Types, and Operations","Variabel, Tipe Data, dan Operasi","python-variabel-tipe-data",{"id":87,"title":88,"title_id":89,"slug":90,"cover_image":21},{"id":153,"title":154,"title_id":155,"slug":156,"cover_image":21},19,"Control Structures","Struktur Kontrol","python-struktur-kontrol",{"id":158,"title":159,"title_id":160,"slug":161,"cover_image":21},20,"Functional Programming with Python","Pemrograman Fungsional dengan Python","python-pemrograman-fungsional",{"id":163,"title":164,"title_id":165,"slug":166,"cover_image":21},30,"Collections and Strings","Koleksi dan String","python-collections",[168],{"authors_id":169},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},"en",[170,172],"id","\nA module is just a Python file that another file can import, so it can reuse the code inside without copying it. Any `.py` file you have written already counts as one. You moved the report into `report.py`, and a second file needed one function from it. So you wrote `import report` at the top and ran that second file.\n\nThe import ran the whole report. It read your input first, then printed every row and the total, all before the second file reached its next line. Nothing raised an error, so nothing told you why.\n\nThe cause is one rule about what `import` does, and the fix is one line plus a small rearrangement. You will see both fail and pass.\n\n## Two files, one command\n\nThe contract is the same as in the earlier articles, such as [Python Dictionaries: the Key That Isn't There](\u002Fp\u002Fpython-dictionary). You write the program, the article hands you a checker, and you run the checker until it goes from red to green. You need two files and `python3`. There is no repository, no Docker and no account.\n\nSave this as `report.py`. It is your script as it stands, with the report at the top level:\n\n```python\n# report.py\nimport sys\n\nrows = []\nfor line in sys.stdin:\n    line = line.strip()\n    if not line:\n        continue\n    name, qty = line.split(\",\")\n    rows.append((name, int(qty)))\n\ntotal = sum(qty for _, qty in rows)\nprint(\"item,qty\")\nfor name, qty in rows:\n    print(f\"{name},{qty}\")\nprint(f\"total,{total}\")\n```\n\n## What import does to a file\n\nThe file's name is the name you import: `report.py` is imported as `report`, with the `.py` left off.\n\nWhen Python meets `import report`, it finds the file and runs it from top to bottom, right then. It does this once per process. Every top-level line executes: the loop over `sys.stdin`, the `sum`, each `print`. Python has no idea which lines you meant as the reusable part.\n\nWhere does it look for the file? The folder of the script you ran goes first on the import path. I checked this with a one-line probe in a folder named `probe`. Running `python3 path_probe.py` there, `sys.path[0]` had the basename `probe`. That is why two files in one folder can import each other with no setup.\n\nNow the starter, imported. It prints the full report: `item,qty`, `kopi,3`, `teh,2`, `kopi,4`, `total,9`. It has a second problem too. `total` is a finished number, not a function, so calling it raises `TypeError: 'int' object is not callable`.\n\nSave the checker next to `report.py`. It feeds the program `kopi,3`, `teh,2` and `kopi,4`, and it expects a total of 9. It runs your file once as a script and twice as an import.\n\n```python\n# check_report.py\nimport subprocess\nimport sys\n\nDATA = \"\"\"kopi,3\nteh,2\nkopi,4\n\"\"\"\n\nEXPECTED = \"\"\"item,qty\nkopi,3\nteh,2\nkopi,4\ntotal,9\"\"\"\n\n\ndef run(args, stdin=\"\"):\n    return subprocess.run(\n        [sys.executable] + args,\n        input=stdin,\n        text=True,\n        capture_output=True,\n    )\n\n\ndef report(results):\n    for label, passed, detail in results:\n        mark = \"PASS\" if passed else \"FAIL\"\n        note = f\"  \u003C- {detail}\" if detail and not passed else \"\"\n        print(f\"{mark}  {label}{note}\")\n    passed = [ok for _, ok, _ in results].count(True)\n    print(f\"\\n{passed} of {len(results)} checks passed\")\n\n\ndef main():\n    as_script = run([\"report.py\"], DATA)\n    as_import = run([\"-c\", \"import report\"], DATA)\n    as_call = run([\"-c\", \"import report; print(report.total([('a', 1), ('b', 2)]))\"])\n\n    stderr_script = as_script.stderr.strip().splitlines()\n    results = [\n        (\"the script runs without crashing\", as_script.returncode == 0,\n         stderr_script[-1] if stderr_script else \"\"),\n        (\"the script prints the report, total last\", as_script.stdout.strip() == EXPECTED,\n         repr(as_script.stdout)),\n        (\"importing it does not crash\", as_import.returncode == 0, as_import.stderr.strip()),\n        (\"importing it prints nothing\", as_import.stdout == \"\", repr(as_import.stdout)),\n        (\"total() is a function you can call\", as_call.returncode == 0 and as_call.stdout.strip() == \"3\",\n         as_call.stderr.strip().splitlines()[-1] if as_call.stderr.strip() else repr(as_call.stdout)),\n    ]\n\n    report(results)\n    return 0 if all(ok for _, ok, _ in results) else 1\n\n\nif __name__ == \"__main__\":\n    sys.exit(main())\n```\n\nRun it:\n\n```\npython3 check_report.py\n```\n\n```\nPASS  the script runs without crashing\nPASS  the script prints the report, total last\nPASS  importing it does not crash\nFAIL  importing it prints nothing  \u003C- 'item,qty\\nkopi,3\\nteh,2\\nkopi,4\\ntotal,9\\n'\nFAIL  total() is a function you can call  \u003C- TypeError: 'int' object is not callable\n\n3 of 5 checks passed\n```\n\nThe exit code is 1. Run as a script, the file is fine. Both failures come from the import, and the first one shows you the whole report that leaked out of it.\n\n## One line decides which job the file is doing\n\nPython gives every file a name while it runs. That name lives in `__name__`. It is `__main__` when you run the file yourself, and it is the module name when something imports it.\n\nPut a single line, `print(__name__)`, in a file called `name_probe.py`. Run `python3 name_probe.py` and it prints `__main__`. Import it from another file and the same line prints `name_probe`.\n\nThe code is identical and the name is different. The line `if __name__ == \"__main__\":` compares those two strings. When they match, the indented block runs. When another file imports yours, they do not match and the block is skipped.\n\nSo the plan has two parts. Put the work inside functions, because a `def` only binds a name when the file is imported. Then put the one call that starts the work under the guard.\n\n## The fix\n\nI split the starter into three functions. `parse` reads the rows, `total` adds them up, and `main` prints the report. Now `total` is a function, which clears the `TypeError`. The last two lines hold the guard.\n\n```python\n# report.py\nimport sys\n\n\ndef parse(lines):\n    rows = []\n    for line in lines:\n        line = line.strip()\n        if not line:\n            continue\n        name, qty = line.split(\",\")\n        rows.append((name, int(qty)))\n    return rows\n\n\ndef total(rows):\n    return sum(qty for _, qty in rows)\n\n\ndef main():\n    rows = parse(sys.stdin)\n    print(\"item,qty\")\n    for name, qty in rows:\n        print(f\"{name},{qty}\")\n    print(f\"total,{total(rows)}\")\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\nRun the checker again:\n\n```\npython3 check_report.py\n```\n\n```\nPASS  the script runs without crashing\nPASS  the script prints the report, total last\nPASS  importing it does not crash\nPASS  importing it prints nothing\nPASS  total() is a function you can call\n\n5 of 5 checks passed\n```\n\nThe exit code is 0.\n\n## What this does not do\n\nA package is a folder with an `__init__.py` file, and relative imports are the `from . import` form used inside one. Both are for later. Two files in one folder need neither.\n\nThe guard also does not rescue a `print` you left at module level. If a stray `print(\"debug\")` sits outside every function and outside the guard, each process that imports the file prints it once. The guard protects only the lines indented under it.\n\n## Before the next article\n\nDelete the last two lines of the fixed file: the `if __name__ == \"__main__\":` line and the `main()` call under it. Run the checker again. I measured 4 of 5 and exit code 1, and the only failure is this one:\n\n```\nFAIL  the script prints the report, total last  \u003C- ''\n```\n\nThe script runs and prints nothing. Now put the two lines back and run the checker until it says 5 of 5 again.\n\nThat proves the checker can tell whether the file runs or only imports. It cannot tell whether the code inside `main()` is correct.\n\nIf `import` runs a whole file, what else in your old scripts has been running at the top level all along?\n","- `import report` runs the whole file from top to bottom at that moment, so top-level work happens again inside whatever imported it.\n- `__name__` is `__main__` when you run the file yourself and the module name when something imports it; the guard compares those two strings.\n- Work belongs inside functions, because a `def` only binds a name, and the call under `if __name__ == \"__main__\":` is what starts the work.\n- A value computed at module level is finished once: the starter's `total` was the number 9, so calling it raised `TypeError: 'int' object is not callable`.\n- The guard protects only the lines indented under it, so a stray top-level `print` still fires on every import.","\u003Cp>A module is just a Python file that another file can import, so it can reuse the code inside without copying it. Any \u003Ccode>.py\u003C\u002Fcode> file you have written already counts as one. You moved the report into \u003Ccode>report.py\u003C\u002Fcode>, and a second file needed one function from it. So you wrote \u003Ccode>import report\u003C\u002Fcode> at the top and ran that second file.\u003C\u002Fp>\n\u003Cp>The import ran the whole report. It read your input first, then printed every row and the total, all before the second file reached its next line. Nothing raised an error, so nothing told you why.\u003C\u002Fp>\n\u003Cp>The cause is one rule about what \u003Ccode>import\u003C\u002Fcode> does, and the fix is one line plus a small rearrangement. You will see both fail and pass.\u003C\u002Fp>\n\u003Ch2 id=\"two-files-one-command\">Two files, one command\u003C\u002Fh2>\n\u003Cp>The contract is the same as in the earlier articles, such as \u003Ca href=\"\u002Fp\u002Fpython-dictionary\">Python Dictionaries: the Key That Isn&#39;t There\u003C\u002Fa>. You write the program, the article hands you a checker, and you run the checker until it goes from red to green. You need two files and \u003Ccode>python3\u003C\u002Fcode>. There is no repository, no Docker and no account.\u003C\u002Fp>\n\u003Cp>Save this as \u003Ccode>report.py\u003C\u002Fcode>. It is your script as it stands, with the report at the top level:\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">PYTHON\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%23%20report.py%0Aimport%20sys%0A%0Arows%20%3D%20%5B%5D%0Afor%20line%20in%20sys.stdin%3A%0A%20%20%20%20line%20%3D%20line.strip()%0A%20%20%20%20if%20not%20line%3A%0A%20%20%20%20%20%20%20%20continue%0A%20%20%20%20name%2C%20qty%20%3D%20line.split(%22%2C%22)%0A%20%20%20%20rows.append((name%2C%20int(qty)))%0A%0Atotal%20%3D%20sum(qty%20for%20_%2C%20qty%20in%20rows)%0Aprint(%22item%2Cqty%22)%0Afor%20name%2C%20qty%20in%20rows%3A%0A%20%20%20%20print(f%22%7Bname%7D%2C%7Bqty%7D%22)%0Aprint(f%22total%2C%7Btotal%7D%22)\" title=\"Salin kode\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\"># report.py\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> sys\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">rows \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> []\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> line \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> sys.stdin:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    line \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> line.strip()\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    if\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> not\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> line:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        continue\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    name, qty \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> line.split(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\",\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    rows.append((name, \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">int\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(qty)))\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">total \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> sum\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(qty \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> _, qty \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> rows)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">print\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"item,qty\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> name, qty \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> rows:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">    print\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">f\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">name\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">,\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">qty\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">print\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">f\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"total,\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">total\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Ch2 id=\"what-import-does-to-a-file\">What import does to a file\u003C\u002Fh2>\n\u003Cp>The file&#39;s name is the name you import: \u003Ccode>report.py\u003C\u002Fcode> is imported as \u003Ccode>report\u003C\u002Fcode>, with the \u003Ccode>.py\u003C\u002Fcode> left off.\u003C\u002Fp>\n\u003Cp>When Python meets \u003Ccode>import report\u003C\u002Fcode>, it finds the file and runs it from top to bottom, right then. It does this once per process. Every top-level line executes: the loop over \u003Ccode>sys.stdin\u003C\u002Fcode>, the \u003Ccode>sum\u003C\u002Fcode>, each \u003Ccode>print\u003C\u002Fcode>. Python has no idea which lines you meant as the reusable part.\u003C\u002Fp>\n\u003Cp>Where does it look for the file? The folder of the script you ran goes first on the import path. I checked this with a one-line probe in a folder named \u003Ccode>probe\u003C\u002Fcode>. Running \u003Ccode>python3 path_probe.py\u003C\u002Fcode> there, \u003Ccode>sys.path[0]\u003C\u002Fcode> had the basename \u003Ccode>probe\u003C\u002Fcode>. That is why two files in one folder can import each other with no setup.\u003C\u002Fp>\n\u003Cp>Now the starter, imported. It prints the full report: \u003Ccode>item,qty\u003C\u002Fcode>, \u003Ccode>kopi,3\u003C\u002Fcode>, \u003Ccode>teh,2\u003C\u002Fcode>, \u003Ccode>kopi,4\u003C\u002Fcode>, \u003Ccode>total,9\u003C\u002Fcode>. It has a second problem too. \u003Ccode>total\u003C\u002Fcode> is a finished number, not a function, so calling it raises \u003Ccode>TypeError: &#39;int&#39; object is not callable\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Cp>Save the checker next to \u003Ccode>report.py\u003C\u002Fcode>. It feeds the program \u003Ccode>kopi,3\u003C\u002Fcode>, \u003Ccode>teh,2\u003C\u002Fcode> and \u003Ccode>kopi,4\u003C\u002Fcode>, and it expects a total of 9. It runs your file once as a script and twice as an import.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">PYTHON\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%23%20check_report.py%0Aimport%20subprocess%0Aimport%20sys%0A%0ADATA%20%3D%20%22%22%22kopi%2C3%0Ateh%2C2%0Akopi%2C4%0A%22%22%22%0A%0AEXPECTED%20%3D%20%22%22%22item%2Cqty%0Akopi%2C3%0Ateh%2C2%0Akopi%2C4%0Atotal%2C9%22%22%22%0A%0A%0Adef%20run(args%2C%20stdin%3D%22%22)%3A%0A%20%20%20%20return%20subprocess.run(%0A%20%20%20%20%20%20%20%20%5Bsys.executable%5D%20%2B%20args%2C%0A%20%20%20%20%20%20%20%20input%3Dstdin%2C%0A%20%20%20%20%20%20%20%20text%3DTrue%2C%0A%20%20%20%20%20%20%20%20capture_output%3DTrue%2C%0A%20%20%20%20)%0A%0A%0Adef%20report(results)%3A%0A%20%20%20%20for%20label%2C%20passed%2C%20detail%20in%20results%3A%0A%20%20%20%20%20%20%20%20mark%20%3D%20%22PASS%22%20if%20passed%20else%20%22FAIL%22%0A%20%20%20%20%20%20%20%20note%20%3D%20f%22%20%20%3C-%20%7Bdetail%7D%22%20if%20detail%20and%20not%20passed%20else%20%22%22%0A%20%20%20%20%20%20%20%20print(f%22%7Bmark%7D%20%20%7Blabel%7D%7Bnote%7D%22)%0A%20%20%20%20passed%20%3D%20%5Bok%20for%20_%2C%20ok%2C%20_%20in%20results%5D.count(True)%0A%20%20%20%20print(f%22%5Cn%7Bpassed%7D%20of%20%7Blen(results)%7D%20checks%20passed%22)%0A%0A%0Adef%20main()%3A%0A%20%20%20%20as_script%20%3D%20run(%5B%22report.py%22%5D%2C%20DATA)%0A%20%20%20%20as_import%20%3D%20run(%5B%22-c%22%2C%20%22import%20report%22%5D%2C%20DATA)%0A%20%20%20%20as_call%20%3D%20run(%5B%22-c%22%2C%20%22import%20report%3B%20print(report.total(%5B('a'%2C%201)%2C%20('b'%2C%202)%5D))%22%5D)%0A%0A%20%20%20%20stderr_script%20%3D%20as_script.stderr.strip().splitlines()%0A%20%20%20%20results%20%3D%20%5B%0A%20%20%20%20%20%20%20%20(%22the%20script%20runs%20without%20crashing%22%2C%20as_script.returncode%20%3D%3D%200%2C%0A%20%20%20%20%20%20%20%20%20stderr_script%5B-1%5D%20if%20stderr_script%20else%20%22%22)%2C%0A%20%20%20%20%20%20%20%20(%22the%20script%20prints%20the%20report%2C%20total%20last%22%2C%20as_script.stdout.strip()%20%3D%3D%20EXPECTED%2C%0A%20%20%20%20%20%20%20%20%20repr(as_script.stdout))%2C%0A%20%20%20%20%20%20%20%20(%22importing%20it%20does%20not%20crash%22%2C%20as_import.returncode%20%3D%3D%200%2C%20as_import.stderr.strip())%2C%0A%20%20%20%20%20%20%20%20(%22importing%20it%20prints%20nothing%22%2C%20as_import.stdout%20%3D%3D%20%22%22%2C%20repr(as_import.stdout))%2C%0A%20%20%20%20%20%20%20%20(%22total()%20is%20a%20function%20you%20can%20call%22%2C%20as_call.returncode%20%3D%3D%200%20and%20as_call.stdout.strip()%20%3D%3D%20%223%22%2C%0A%20%20%20%20%20%20%20%20%20as_call.stderr.strip().splitlines()%5B-1%5D%20if%20as_call.stderr.strip()%20else%20repr(as_call.stdout))%2C%0A%20%20%20%20%5D%0A%0A%20%20%20%20report(results)%0A%20%20%20%20return%200%20if%20all(ok%20for%20_%2C%20ok%2C%20_%20in%20results)%20else%201%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20sys.exit(main())\" title=\"Salin kode\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\"># check_report.py\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> subprocess\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> sys\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">DATA\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> =\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"\"\"kopi,3\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#9ECBFF\">teh,2\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#9ECBFF\">kopi,4\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#9ECBFF\">\"\"\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">EXPECTED\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> =\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"\"\"item,qty\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#9ECBFF\">kopi,3\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#9ECBFF\">teh,2\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#9ECBFF\">kopi,4\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#9ECBFF\">total,9\"\"\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">def\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> run\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(args, stdin\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">):\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    return\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> subprocess.run(\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        [sys.executable] \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">+\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> args,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#FFAB70\">        input\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">stdin,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#FFAB70\">        text\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">True\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#FFAB70\">        capture_output\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">True\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    )\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">def\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> report\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(results):\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> label, passed, detail \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> results:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        mark \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"PASS\"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> passed \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">else\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"FAIL\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        note \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> f\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"  &#x3C;- \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">detail\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> detail \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">and\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> not\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> passed \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">else\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">        print\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">f\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">mark\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">  {\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">label\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">note\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    passed \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> [ok \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> _, ok, _ \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> results].count(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">True\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">    print\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">f\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">\\n{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">passed\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> of \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{len\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(results)\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> checks passed\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">def\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> main\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">():\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    as_script \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> run([\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"report.py\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">], \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">DATA\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    as_import \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> run([\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"-c\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"import report\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">], \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">DATA\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    as_call \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> run([\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"-c\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"import report; print(report.total([('a', 1), ('b', 2)]))\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">])\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    stderr_script \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> as_script.stderr.strip().splitlines()\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    results \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> [\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        (\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"the script runs without crashing\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, as_script.returncode \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">==\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 0\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">         stderr_script[\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">-\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">1\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">] \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> stderr_script \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">else\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">),\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        (\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"the script prints the report, total last\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, as_script.stdout.strip() \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">==\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> EXPECTED\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">         repr\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(as_script.stdout)),\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        (\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"importing it does not crash\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, as_import.returncode \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">==\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 0\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, as_import.stderr.strip()),\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        (\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"importing it prints nothing\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, as_import.stdout \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">==\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">repr\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(as_import.stdout)),\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        (\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"total() is a function you can call\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, as_call.returncode \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">==\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 0\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> and\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> as_call.stdout.strip() \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">==\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"3\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">         as_call.stderr.strip().splitlines()[\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">-\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">1\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">] \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> as_call.stderr.strip() \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">else\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> repr\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(as_call.stdout)),\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    ]\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    report(results)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    return\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 0\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> if\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> all\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(ok \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> _, ok, _ \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> results) \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">else\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 1\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">if\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> __name__\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> ==\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"__main__\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    sys.exit(main())\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>Run it:\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">TEXT\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"python3%20check_report.py\" title=\"Salin kode\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>python3 check_report.py\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">TEXT\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"PASS%20%20the%20script%20runs%20without%20crashing%0APASS%20%20the%20script%20prints%20the%20report%2C%20total%20last%0APASS%20%20importing%20it%20does%20not%20crash%0AFAIL%20%20importing%20it%20prints%20nothing%20%20%3C-%20'item%2Cqty%5Cnkopi%2C3%5Cnteh%2C2%5Cnkopi%2C4%5Cntotal%2C9%5Cn'%0AFAIL%20%20total()%20is%20a%20function%20you%20can%20call%20%20%3C-%20TypeError%3A%20'int'%20object%20is%20not%20callable%0A%0A3%20of%205%20checks%20passed\" title=\"Salin kode\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>PASS  the script runs without crashing\nPASS  the script prints the report, total last\nPASS  importing it does not crash\nFAIL  importing it prints nothing  &lt;- 'item,qty\\nkopi,3\\nteh,2\\nkopi,4\\ntotal,9\\n'\nFAIL  total() is a function you can call  &lt;- TypeError: 'int' object is not callable\n\n3 of 5 checks passed\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>The exit code is 1. Run as a script, the file is fine. Both failures come from the import, and the first one shows you the whole report that leaked out of it.\u003C\u002Fp>\n\u003Ch2 id=\"one-line-decides-which-job-the-file-is-doing\">One line decides which job the file is doing\u003C\u002Fh2>\n\u003Cp>Python gives every file a name while it runs. That name lives in \u003Ccode>__name__\u003C\u002Fcode>. It is \u003Ccode>__main__\u003C\u002Fcode> when you run the file yourself, and it is the module name when something imports it.\u003C\u002Fp>\n\u003Cp>Put a single line, \u003Ccode>print(__name__)\u003C\u002Fcode>, in a file called \u003Ccode>name_probe.py\u003C\u002Fcode>. Run \u003Ccode>python3 name_probe.py\u003C\u002Fcode> and it prints \u003Ccode>__main__\u003C\u002Fcode>. Import it from another file and the same line prints \u003Ccode>name_probe\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Cp>The code is identical and the name is different. The line \u003Ccode>if __name__ == &quot;__main__&quot;:\u003C\u002Fcode> compares those two strings. When they match, the indented block runs. When another file imports yours, they do not match and the block is skipped.\u003C\u002Fp>\n\u003Cp>So the plan has two parts. Put the work inside functions, because a \u003Ccode>def\u003C\u002Fcode> only binds a name when the file is imported. Then put the one call that starts the work under the guard.\u003C\u002Fp>\n\u003Ch2 id=\"the-fix\">The fix\u003C\u002Fh2>\n\u003Cp>I split the starter into three functions. \u003Ccode>parse\u003C\u002Fcode> reads the rows, \u003Ccode>total\u003C\u002Fcode> adds them up, and \u003Ccode>main\u003C\u002Fcode> prints the report. Now \u003Ccode>total\u003C\u002Fcode> is a function, which clears the \u003Ccode>TypeError\u003C\u002Fcode>. The last two lines hold the guard.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">PYTHON\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%23%20report.py%0Aimport%20sys%0A%0A%0Adef%20parse(lines)%3A%0A%20%20%20%20rows%20%3D%20%5B%5D%0A%20%20%20%20for%20line%20in%20lines%3A%0A%20%20%20%20%20%20%20%20line%20%3D%20line.strip()%0A%20%20%20%20%20%20%20%20if%20not%20line%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20continue%0A%20%20%20%20%20%20%20%20name%2C%20qty%20%3D%20line.split(%22%2C%22)%0A%20%20%20%20%20%20%20%20rows.append((name%2C%20int(qty)))%0A%20%20%20%20return%20rows%0A%0A%0Adef%20total(rows)%3A%0A%20%20%20%20return%20sum(qty%20for%20_%2C%20qty%20in%20rows)%0A%0A%0Adef%20main()%3A%0A%20%20%20%20rows%20%3D%20parse(sys.stdin)%0A%20%20%20%20print(%22item%2Cqty%22)%0A%20%20%20%20for%20name%2C%20qty%20in%20rows%3A%0A%20%20%20%20%20%20%20%20print(f%22%7Bname%7D%2C%7Bqty%7D%22)%0A%20%20%20%20print(f%22total%2C%7Btotal(rows)%7D%22)%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20main()\" title=\"Salin kode\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\"># report.py\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> sys\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">def\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> parse\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(lines):\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    rows \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> []\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> line \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> lines:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        line \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> line.strip()\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        if\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> not\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> line:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">            continue\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        name, qty \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> line.split(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\",\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        rows.append((name, \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">int\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(qty)))\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    return\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> rows\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">def\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> total\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(rows):\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    return\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> sum\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(qty \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> _, qty \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> rows)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">def\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> main\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">():\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    rows \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> parse(sys.stdin)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">    print\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"item,qty\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> name, qty \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> rows:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">        print\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">f\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">name\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">,\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">qty\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">    print\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">f\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"total,\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">total(rows)\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">if\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> __name__\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> ==\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"__main__\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    main()\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>Run the checker again:\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">TEXT\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"python3%20check_report.py\" title=\"Salin kode\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>python3 check_report.py\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">TEXT\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"PASS%20%20the%20script%20runs%20without%20crashing%0APASS%20%20the%20script%20prints%20the%20report%2C%20total%20last%0APASS%20%20importing%20it%20does%20not%20crash%0APASS%20%20importing%20it%20prints%20nothing%0APASS%20%20total()%20is%20a%20function%20you%20can%20call%0A%0A5%20of%205%20checks%20passed\" title=\"Salin kode\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>PASS  the script runs without crashing\nPASS  the script prints the report, total last\nPASS  importing it does not crash\nPASS  importing it prints nothing\nPASS  total() is a function you can call\n\n5 of 5 checks passed\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>The exit code is 0.\u003C\u002Fp>\n\u003Ch2 id=\"what-this-does-not-do\">What this does not do\u003C\u002Fh2>\n\u003Cp>A package is a folder with an \u003Ccode>__init__.py\u003C\u002Fcode> file, and relative imports are the \u003Ccode>from . import\u003C\u002Fcode> form used inside one. Both are for later. Two files in one folder need neither.\u003C\u002Fp>\n\u003Cp>The guard also does not rescue a \u003Ccode>print\u003C\u002Fcode> you left at module level. If a stray \u003Ccode>print(&quot;debug&quot;)\u003C\u002Fcode> sits outside every function and outside the guard, each process that imports the file prints it once. The guard protects only the lines indented under it.\u003C\u002Fp>\n\u003Ch2 id=\"before-the-next-article\">Before the next article\u003C\u002Fh2>\n\u003Cp>Delete the last two lines of the fixed file: the \u003Ccode>if __name__ == &quot;__main__&quot;:\u003C\u002Fcode> line and the \u003Ccode>main()\u003C\u002Fcode> call under it. Run the checker again. I measured 4 of 5 and exit code 1, and the only failure is this one:\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">TEXT\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"FAIL%20%20the%20script%20prints%20the%20report%2C%20total%20last%20%20%3C-%20''\" title=\"Salin kode\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>FAIL  the script prints the report, total last  &lt;- ''\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>The script runs and prints nothing. Now put the two lines back and run the checker until it says 5 of 5 again.\u003C\u002Fp>\n\u003Cp>That proves the checker can tell whether the file runs or only imports. It cannot tell whether the code inside \u003Ccode>main()\u003C\u002Fcode> is correct.\u003C\u002Fp>\n\u003Cp>If \u003Ccode>import\u003C\u002Fcode> runs a whole file, what else in your old scripts has been running at the top level all along?\u003C\u002Fp>\n","\u003Cul>\n\u003Cli>\u003Ccode>import report\u003C\u002Fcode> runs the whole file from top to bottom at that moment, so top-level work happens again inside whatever imported it.\u003C\u002Fli>\n\u003Cli>\u003Ccode>__name__\u003C\u002Fcode> is \u003Ccode>__main__\u003C\u002Fcode> when you run the file yourself and the module name when something imports it; the guard compares those two strings.\u003C\u002Fli>\n\u003Cli>Work belongs inside functions, because a \u003Ccode>def\u003C\u002Fcode> only binds a name, and the call under \u003Ccode>if __name__ == &quot;__main__&quot;:\u003C\u002Fcode> is what starts the work.\u003C\u002Fli>\n\u003Cli>A value computed at module level is finished once: the starter&#39;s \u003Ccode>total\u003C\u002Fcode> was the number 9, so calling it raised \u003Ccode>TypeError: &#39;int&#39; object is not callable\u003C\u002Fcode>.\u003C\u002Fli>\n\u003Cli>The guard protects only the lines indented under it, so a stray top-level \u003Ccode>print\u003C\u002Fcode> still fires on every import.\u003C\u002Fli>\n\u003C\u002Ful>\n",[178,195,200,217,231,247],{"id":179,"title":180,"title_id":181,"slug":182,"excerpt":183,"excerpt_id":184,"has_translation":12,"published_at":80,"reading_time":14,"hidden_from_listing":15,"tags":185,"thumbnail_image":21,"og_image":188,"series":189,"authors":192},137,"Java Operators: the Average That Came Out a Whole Number","Operator Java: Rata-Rata yang Keluar Sebagai Bilangan Bulat","java-operators","Three scores, one division, and the average prints as 82. Both operands are `int`, so the fraction is cut off, and the obvious cast prints `82.0` without fixing anything.","Tiga nilai, satu pembagian, dan rata-ratanya tercetak 82. Kedua operand-nya `int`, jadi pecahannya dipotong, dan cast yang paling wajar malah mencetak `82.0` tanpa memperbaiki apa pun.",[186,187],"java","operator","\u002Fog\u002Fjava-operators.png",{"id":190,"title":148,"title_id":149,"slug":191},22,"java-variabel-tipe-data",[193],{"authors_id":194},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":74,"title":75,"title_id":76,"slug":77,"excerpt":78,"excerpt_id":79,"has_translation":12,"published_at":80,"reading_time":81,"hidden_from_listing":15,"tags":82,"thumbnail_image":21,"og_image":85,"series":196,"authors":197},{"id":87,"title":88,"title_id":89,"slug":90},[198],{"authors_id":199},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":201,"title":202,"title_id":21,"slug":203,"excerpt":204,"excerpt_id":21,"has_translation":15,"published_at":205,"reading_time":102,"hidden_from_listing":15,"tags":206,"thumbnail_image":21,"og_image":211,"series":212,"authors":214},135,"Caching That Never Hits Costs More Than No Caching","caching-that-never-hits","Same model, same conversation, same token count, and a bill five times higher. The cause is a prefix that changes, a write premium nobody reads about, and a cost curve that grows faster than the loop.","2026-11-04T01:10:00.000Z",[207,208,209,210],"llm","ai-agent","cache","api","\u002Fog\u002Fcaching-that-never-hits.png",{"id":213,"title":35,"title_id":36,"slug":37},8,[215],{"authors_id":216},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":218,"title":219,"title_id":21,"slug":220,"excerpt":221,"excerpt_id":21,"has_translation":15,"published_at":222,"reading_time":14,"hidden_from_listing":15,"tags":223,"thumbnail_image":21,"og_image":226,"series":227,"authors":228},134,"Your Stream Dies at 125 Seconds and Nothing in Your Code Says 125","your-stream-dies-at-125-seconds","Streaming moves the wait into a connection that outlives the request. Four layers sit between the model and the browser, their idle timeouts disagree, and the smallest one ends your stream.","2026-11-04T01:00:00.000Z",[224,225,208,210],"streaming","sse","\u002Fog\u002Fyour-stream-dies-at-125-seconds.png",{"id":213,"title":35,"title_id":36,"slug":37},[229],{"authors_id":230},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":232,"title":233,"title_id":234,"slug":235,"excerpt":236,"excerpt_id":237,"has_translation":12,"published_at":238,"reading_time":239,"hidden_from_listing":15,"tags":240,"thumbnail_image":21,"og_image":242,"series":243,"authors":244},133,"Python Strings: the Badge That Only Worked for One Name","String Python: Badge yang Cuma Jalan untuk Satu Nama","python-strings","The badge script printed the right name for the person who wrote it and the wrong name for everybody else. Slicing counts characters, and a name is words.","Skrip badge mencetak nama yang benar untuk orang yang menulisnya dan nama yang salah untuk semua orang lain. Slicing menghitung karakter, sedangkan nama itu kata.","2026-10-28T13:00:00.000Z",6,[83,241],"string","\u002Fog\u002Fpython-strings.png",{"id":163,"title":164,"title_id":165,"slug":166},[245],{"authors_id":246},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},{"id":248,"title":249,"title_id":250,"slug":251,"excerpt":252,"excerpt_id":253,"has_translation":12,"published_at":254,"reading_time":239,"hidden_from_listing":15,"tags":255,"thumbnail_image":21,"og_image":257,"series":258,"authors":259},132,"Python Tuples: Why All Three Points Are the Same Point","Tuple Python: Kenapa Ketiga Titik Itu Titik yang Sama","python-tuples","Three points walk into a loop and come out identical. The list was never copied three times; the name was. A tuple makes that bug impossible.","Tiga titik masuk ke satu loop dan keluar identik. List-nya nggak pernah disalin tiga kali; yang disalin cuma namanya. Tuple membuat bug ini mustahil terjadi.","2026-10-28T12:00:00.000Z",[83,256],"tuple","\u002Fog\u002Fpython-tuples.png",{"id":163,"title":164,"title_id":165,"slug":166},[260],{"authors_id":261},{"id":111,"name":112,"slug":113,"role":114,"profile_picture":21},[263,267,270,273,276,279],{"text":264,"depth":265,"id":266},"Two files, one command",2,"two-files-one-command",{"text":268,"depth":265,"id":269},"What import does to a file","what-import-does-to-a-file",{"text":271,"depth":265,"id":272},"One line decides which job the file is doing","one-line-decides-which-job-the-file-is-doing",{"text":274,"depth":265,"id":275},"The fix","the-fix",{"text":277,"depth":265,"id":278},"What this does not do","what-this-does-not-do",{"text":280,"depth":265,"id":281},"Before the next article","before-the-next-article",1793986940545]