[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-682223-en":3,"doc-seo-682223-105":35,"detail-sidebar-cat-0-en-105":101,"doc-similar-682223":148},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":11,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":21,"language":22,"language_code":23,"site_id":24,"html_lang":23,"table_of_contents":25,"faqs":26,"seo_title":27,"seo_description":14,"update_tm":28,"read_time":29,"preview_page_count":20,"preview_urls":30},682223,962088006270,"eBook King","https://ap-avatar.wpscdn.com/davatar_085a072bc5b1113ac321206ff7593b45",6,"Technology","Python PEP8 style guide - Cheat Sheet - Naming conventions - Maximum Line Length and Line Breaking - Indentation - Comments - Code Layout","Python PEP 8 style guide cheat sheet covering essential conventions for writing readable code. It specifies naming rules to avoid confusing single-letter identifiers, recommends limiting lines to 79 characters, and explains safe line continuation using parentheses, brackets, braces, or explicit backslashes. It outlines 4-space indentation and spacing practices around operators, commas, colons, and function calls. It also gives guidance on comments, docstrings, blank lines, indentation after line breaks, and the placement of closing brackets.","Python PEP8 style guide Cheat Sheet by jmds [via](via cheatography.com/84942/cs/20012/)[ cheatography.com/84942/cs/20012/](via cheatography.com/84942/cs/20012/)  \nNaming conventions  \n| Never use l , O , or I single letter names as these can be mistaken for 1 and 0 , depending on typeface | O = 2 \\# This may look like you're trying toreassign 2 to zero |\n| --- | --- |\n| Function | function , my_function |\n| Variable | x , var , my_variable |\n| Class | Model , MyClass |\n| Method | class_method , method |\n| Constant | CONSTANT , MY_CON‐ STANT , MY_LONG_C‐ ONSTANT |\n| Module | [module.py](module.py), my_mod‐ [ule.py](ule.py) |\n| Package | package , mypackage |\n\nMaximum Line Length and Line Breaking  \nPEP 8 suggests lines should be limited to 79 characters . This is because it allows you to have multiple files open next to one another , while also avoiding line wrapping .  \nPython will assume line continuation if code is contained within parentheses , brackets , or braces :  \ndef function (arg_one , arg_two ,  \narg_three , arg_four) :  \nreturn arg_one  \nIf it is impossible to use implied continuation , then you can use backs lashes to break lines instead:  \nfrom mypkg import example 1 , \\ example2 , example3  \n\\# Recommended  \ntotal = (first_variable  \n+ second_variable  \n- third_variable )  \n\\# Not Recommended  \ntotal = (first_variable +  \nsecond_variable   \nthird_variable )  \nIdentation  \nUse 4 consecutive spaces to indicate indentation.  \nPrefer spaces over tabs.  \nComments  \n\n| Limit the line length of | Use complete | Make sure to update |\n| --- | --- | --- |\n| comments and | sentences , starting | comments if you |\n| docstrings to 72 | with a capital | change your code. |\n| characters. | letter. |  |\n| Block Comments |  |  |\n| Indent block comments | Start each line | Separate |\n| to the same level as the | with a \\# followed | paragraphs by a |\n| code they describe. | by a single space. | line containing a single \\# . |\n| Inline Comments |  |  |\n| Use inline comments sparingly. |  |  |\n| Write inline comments on the same line as the statement they refer to. |  |  |\n| Separate inline comments by two or more spaces from the statement. |  |  |\n| Start inline comments with a \\# and a single space , like block comments. |  |  |\n| Don’t use them to explain the obvious. |  |  |\n| When to Avoid Adding Whitespace |  |  |\n| The most important place to avoid adding whitespace is at the end of a line. This is known as trailing whitespace |  |  |\n| Immediately inside parentheses , brackets , or braces: |  |  |\n| Before a comma , semicolon , or colon: |  |  |\n| Before the open parenthesis that starts the argument list of a function call: |  |  |\n| Before the open bracket that starts an index or slice: |  |  |\n| Between a trailing comma and a closing parenthesis: |  |  |\n| To align assignment operators: |  |  |\n| immediately inside brackets , as well as before commas and colons. |  |  |\n| Programming Recommendations |  |  |\n\nDon’t compare boolean values to True or False using the equivalence operator.  \nUse the fact that empty sequences are falsy in if statements.  \nUse is not rather than not   is in if statements.  \nDon’t use if x: when you mean if x is not None:  \nUse .startswith() and .endswith() instead of slicing.  \nBy jmds  \n[cheatography.com/jmds/](cheatography.com/jmds/)  \nNot published yet.  \nLast updated 10th July , 2019. Page 1 of 3.  \nSponsored [by](by CrosswordCheats.com)[ CrosswordCheats.com](by CrosswordCheats.com)[ ](by CrosswordCheats.com)Learn to solve cryptic crosswords!  \n[http://crosswordcheats.com](http://crosswordcheats.com)  \nPython PEP8 style guide Cheat Sheet by jmds [via](via cheatography.com/84942/cs/20012/)[ cheatography.com/84942/cs/20012/](via cheatography.com/84942/cs/20012/)  \nCode Layout  \n\n|  |\n| --- |\n| \u003Cbr>Surround top-level functions and classes with two blank lines\u003Cbr>Surround method definitions inside classes with a single blank line.\u003Cbr>\u003Cbr>Use blank lines sparingly inside functions to show clear s","cbCaihnLW0edvsub","https://ap.wps.com/l/cbCaihnLW0edvsub","pdf",68558,1,3,"English","en",105,"# Naming conventions\n# Maximum Line Length and Line Breaking\n# Indentation\n# Comments\n# Code Layout\n# Documentation Strings\n# Whitespace Around Binary Operators\n# Indentation Following Line Breaks\n# Where to Put the Closing Brace","[{\"question\":\"Why should naming conventions avoid single-letter names like l, O, or I?\",\"answer\":\"Because these can be mistaken for digits (such as 1 and 0) depending on the typeface, which reduces clarity.\"},{\"question\":\"How does PEP 8 recommend handling long lines over 79 characters?\",\"answer\":\"Use implicit line continuation inside parentheses, brackets, or braces; if that’s impossible, use backslashes to break lines.\"},{\"question\":\"What are the key indentation and blank-line rules in PEP 8?\",\"answer\":\"Use 4 consecutive spaces (prefer spaces over tabs), and apply blank lines to separate top-level functions/classes and to structure readability inside functions and methods.\"}]","Python PEP8 style guide - Cheat Sheet - Naming conventions - Maximum Line Length and Line Breaking - Indentation - Comments - Code Layout | PDF",1793963021,8,[31],{"page_no":20,"url":32,"width":33,"height":34},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/5fbe0f784991c94dea21ba5692d5a531.webp",983,1391,{"code":4,"msg":36,"data":37},"ok",{"site_id":24,"language":23,"slug":38,"title":13,"keywords":39,"description":14,"schema_data":40,"social_meta":96,"head_meta":98,"extra_data":100,"updated_unix":28},"python-pep8-style-guide-cheat-sheet-naming-conventions-maximum-line-length-and-line-breaking-indentation-comments-code-layout","",{"@graph":41,"@context":95},[42,58,78],{"@type":43,"itemListElement":44},"BreadcrumbList",[45,49,53,55],{"item":46,"name":47,"@type":48,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":50,"name":51,"@type":48,"position":52},"https://docshare.wps.com/document/","Document",2,{"item":54,"name":12,"@type":48,"position":21},"https://docshare.wps.com/document/technology/",{"item":56,"name":13,"@type":48,"position":57},"https://docshare.wps.com/document/python-pep8-style-guide-cheat-sheet-naming-conventions-maximum-line-length-and-line-breaking-indentation-comments-code-layout/682223/",4,{"url":56,"name":13,"@type":59,"image":60,"author":65,"headline":13,"publisher":67,"fileFormat":70,"inLanguage":23,"description":14,"dateModified":71,"datePublished":72,"encodingFormat":70,"isAccessibleForFree":73,"interactionStatistic":74},"DigitalDocument",{"url":61,"@type":62,"width":63,"height":64},"https://docshare.wps.com/thumbnails/python-pep8-style-guide-cheat-sheet-naming-conventions-maximum-line-length-and-line-breaking-indentation-comments-code-layout/682223.png","ImageObject",300,407,{"name":9,"@type":66},"Person",{"url":46,"name":68,"@type":69},"DocShare","Organization","application/pdf","2026-11-28","2026-11-06",true,{"@type":75,"interactionType":76,"userInteractionCount":11},"InteractionCounter",{"@type":77},"ViewAction",{"@type":79,"mainEntity":80},"FAQPage",[81,87,91],{"name":82,"@type":83,"acceptedAnswer":84},"Why should naming conventions avoid single-letter names like l, O, or I?","Question",{"text":85,"@type":86},"Because these can be mistaken for digits (such as 1 and 0) depending on the typeface, which reduces clarity.","Answer",{"name":88,"@type":83,"acceptedAnswer":89},"How does PEP 8 recommend handling long lines over 79 characters?",{"text":90,"@type":86},"Use implicit line continuation inside parentheses, brackets, or braces; if that’s impossible, use backslashes to break lines.",{"name":92,"@type":83,"acceptedAnswer":93},"What are the key indentation and blank-line rules in PEP 8?",{"text":94,"@type":86},"Use 4 consecutive spaces (prefer spaces over tabs), and apply blank lines to separate top-level functions/classes and to structure readability inside functions and methods.","https://schema.org",{"og:url":56,"og:type":97,"og:title":13,"og:site_name":68,"og:description":14},"article",{"robots":99,"canonical":56},"index,follow",{"doc_id":7,"site_id":24},{"code":4,"msg":5,"data":102},[103,107,111,115,120,123,128,132,137,140,144],{"id":20,"doc_module":4,"doc_module_name":51,"category_name":104,"show_sort_weight":105,"slug":106},"Story & Novel",90,"story-novel",{"id":52,"doc_module":4,"doc_module_name":51,"category_name":108,"show_sort_weight":109,"slug":110},"Literature",80,"literature",{"id":57,"doc_module":4,"doc_module_name":51,"category_name":112,"show_sort_weight":113,"slug":114},"Exam",70,"exam",{"id":116,"doc_module":4,"doc_module_name":51,"category_name":117,"show_sort_weight":118,"slug":119},5,"Comic",60,"comic",{"id":11,"doc_module":4,"doc_module_name":51,"category_name":12,"show_sort_weight":121,"slug":122},50,"technology",{"id":124,"doc_module":4,"doc_module_name":51,"category_name":125,"show_sort_weight":126,"slug":127},7,"Healthcare",40,"healthcare",{"id":29,"doc_module":4,"doc_module_name":51,"category_name":129,"show_sort_weight":130,"slug":131},"Research & Report",30,"research-report",{"id":133,"doc_module":4,"doc_module_name":51,"category_name":134,"show_sort_weight":135,"slug":136},9,"Religion & Spirituality",20,"religion-spirituality",{"id":135,"doc_module":4,"doc_module_name":51,"category_name":138,"show_sort_weight":135,"slug":139},"World Cup","world-cup",{"id":141,"doc_module":4,"doc_module_name":51,"category_name":142,"show_sort_weight":141,"slug":143},10,"Lifestyle","lifestyle",{"id":145,"doc_module":4,"doc_module_name":51,"category_name":146,"show_sort_weight":116,"slug":147},19,"General","general",{"list":149,"token":39},[150,156,162,168,174,180,186,192,198,204],{"doc_id":151,"doc_title":152,"file_type":18,"home_preview_img_url":153,"slug":154,"view_count":11,"category_name":12,"create_tm":155},682219,"Python Style Rules - Docstring Conventions - Coding Style","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229998448620/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110619&Signature=N3ajdpsukICvVWTIdg3rNkctq24%3D","python-style-rules-docstring-conventions-coding-style",1793963012,{"doc_id":157,"doc_title":158,"file_type":18,"home_preview_img_url":159,"slug":160,"view_count":57,"category_name":12,"create_tm":161},685680,"ECMA-404 - The JSON Data Interchange Syntax - 2nd Edition - December 2017","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000176288/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110619&Signature=RR5E7yXQ6D2vAdXpvCX1SF3zMpE%3D","ecma-404-the-json-data-interchange-syntax-2nd-edition-december-2017",1794016568,{"doc_id":163,"doc_title":164,"file_type":18,"home_preview_img_url":165,"slug":166,"view_count":21,"category_name":12,"create_tm":167},685678,"Python Lesson 5 - Dictionaries and JSON - Error Trapping, Lists, and Nesting","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000176274/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110619&Signature=r8gWGnOXoLfQa8GqSNIvx2jWUXg%3D","python-lesson-5-dictionaries-and-json-error-trapping-lists-and-nesting",1794016562,{"doc_id":169,"doc_title":170,"file_type":18,"home_preview_img_url":171,"slug":172,"view_count":116,"category_name":12,"create_tm":173},692315,"Good Coding Practices - Python Code Best Practices","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230002739157/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110619&Signature=zs1CLI%2B5giXQ4uDkF6lw4Q%2F4LZM%3D","good-coding-practices-python-code-best-practices",1794193122,{"doc_id":175,"doc_title":176,"file_type":18,"home_preview_img_url":177,"slug":178,"view_count":116,"category_name":12,"create_tm":179},682224,"Python PEP8 - The Style Guide for Python Code","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999427682/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110619&Signature=nCVeTr%2FoQKZoeOARnM%2B42mCQGnE%3D","python-pep8-the-style-guide-for-python-code",1793963024,{"doc_id":181,"doc_title":182,"file_type":18,"home_preview_img_url":183,"slug":184,"view_count":21,"category_name":12,"create_tm":185},707218,"JavaScript Style Guide—Version 2.1 - Guidelines for JavaScript code formatting - Indentation and spacing","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230014637018/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110619&Signature=7jLdQgnEfkMx9EkpCfXU9Ivms%2BY%3D","javascript-style-guideversion-21-guidelines-for-javascript-code-formatting-indentation-and-spacing",1794696414,{"doc_id":187,"doc_title":188,"file_type":18,"home_preview_img_url":189,"slug":190,"view_count":57,"category_name":12,"create_tm":191},692325,"Python Coding Standards - Version A - Released","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230003217830/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110619&Signature=sD%2BOGn5nH73q96g5HOBfYjG%2B1Eg%3D","python-coding-standards-version-a-released",1794193583,{"doc_id":193,"doc_title":194,"file_type":18,"home_preview_img_url":195,"slug":196,"view_count":133,"category_name":12,"create_tm":197},692234,"PYTHON-QUICK GUIDE - Beginner - Start Here","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230003011241/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110619&Signature=JFCG8s56WzGc3EBLsI86jDQ7NGk%3D","python-quick-guide-beginner-start-here",1794186385,{"doc_id":199,"doc_title":200,"file_type":18,"home_preview_img_url":201,"slug":202,"view_count":21,"category_name":12,"create_tm":203},682216,"Python Code Style Guide - Introduction - Format and use of White Space","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999427657/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110619&Signature=DQUcK0gx%2BmCc5XwxZfm28ff3BQA%3D","python-code-style-guide-introduction-format-and-use-of-white-space",1793963005,{"doc_id":205,"doc_title":206,"file_type":18,"home_preview_img_url":207,"slug":208,"view_count":209,"category_name":12,"create_tm":210},391232,"Python Interview Questions - List vs Tuples - Key Features","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917654344/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796110619&Signature=4Zi4xw8liVKdAu%2BO%2FpKsFj7PraY%3D","python-interview-questions-list-vs-tuples-key-features",15,1790350253]