[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-682217-105":59,"doc-detail-682217-en":130,"doc-similar-682217":154},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":123,"head_meta":125,"extra_data":127,"updated_unix":129},105,"en","a-python-style-guide-draft","A Python Style Guide - Draft","","A Python coding practices guide focused on writing implementations that are beautiful, readable, and maintainable for later readers. It frames clarity as a result of leveraging Python syntax and common idioms to convey meaning and programmer intention. The guide presents rules covering version requirements, naming conventions, identifier formatting, whitespace and indentation, line length, quote consistency, and statement layout to reduce confusion and support scalable, correct programs.",{"@graph":69,"@context":122},[70,84,105],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":30,"@type":76,"position":81},"https://docshare.wps.com/document/technology/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/a-python-style-guide-draft/682217/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/a-python-style-guide-draft/682217.png","ImageObject",300,407,{"name":92,"@type":93},"Cipher","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-19","2026-11-06",true,{"@type":102,"interactionType":103,"userInteractionCount":19},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"Why does the guide emphasize “beautiful” algorithm implementations?","Question",{"text":112,"@type":113},"It argues that programs are appreciated through what readers can understand. Good language practices make it easier to express ideas as code and improve human communication.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"What does Rule 1 require for Python version?",{"text":117,"@type":113},"Use only Python version 3, because Python 2 lacks features the guide depends on for scalable and correct programs.",{"name":119,"@type":110,"acceptedAnswer":120},"How should identifiers be named according to Rule 2?",{"text":121,"@type":113},"Use only alphabetic and numeric characters, choose meaningful names, apply camelCase for multiword identifiers, and use underscores only for private or special variables with specific conventions.","https://schema.org",{"og:url":83,"og:type":124,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":126,"canonical":83},"index,follow",{"doc_id":128,"site_id":62},682217,1793963006,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":29,"category_name":30,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":19,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":139,"language":140,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":67,"update_tm":129,"read_time":144,"preview_page_count":14,"preview_urls":145},687208528416,"https://ap-avatar.wpscdn.com/davatar_9964176cb1d06d4a9deccf72a44ae3dc","A Python Style Guide  \nDuane A. Bailey  \n[Draft of September 16, 2020]  \nImplementations of algorithms|programs|can be beautiful. We make programs beautiful because they will be appreciated, later, by some reader. That may be you. If you're a tool-builder, users will view your code by what they read. Good programming languages make it easier to cast our abstract ideas as programs, but they also forman e􀀋ective medium for human communication. Python is no exception.  \nPart of what makes a beautiful algorithm implementation is just its ability to leverage the syntax of the programming language to convey meaning. When an algorithm is written well, the language's presentation facilitates , rather than impedes understanding. Part of the process of learning a language is to learn the common practices and coding idioms. Programming is a social discourse and its idioms e􀀎ciently convey not only program meaning, but programmer intention.  \nThis document is about coding practices|\\pythonic\" approaches|to writing code that facilitates understanding. These are cast as a series of rules, to focus the attention. Straying from these guidelines can have the e􀀋ect of making your code harder for the reader to understand.  \nStill, Orwell might have proposed: break any rule should it lead to a design not worth defending.  \nRule 1 Use only Python version 3 .  \nPython 2 does not include features we depend on to write scalable and correct programs.  \nThis section discusses how we name things or objects in Python. Often, the name given to a value is our only hint at its meaning. Good names make good programs.  \nRule 2 .1 Limit names to alphabetic and numeric characters.  \nThis restriction makes your programs more readable and maintainable.  \nDo: pi, rstrip, reader, atan2  \nRule 2 .2 Use meaningful names. Single character are allowed in for and with.  \nThoughtful naming conveys meaning.  \nDo: answer, position, opponent, wordList  \nDon't: a, p, o, aFile  \nRule 2 .3 Use \\camel case\" to improve readability of multiword identifiers.  \nStart successive words within a name with uppercase letters. A consistent and compact approach makes multiword identi􀀌ers more readable and understandable.  \nDo: mammothMascotImage, purpleCowMotto, diskRead  \nDon't: input file, dread  \nRule 2 .4 Only use underscores to indicate privacy or special variables.  \nUnderscores, while legal characters within names, convey speci􀀌c meanings. Underscores should be avoided except at the beginning of private identi􀀌ers and, used in pairs, surrounding special names. The lone underscore ( _ ) is reserved to mean \\this value is unimportant\".  \nDo:   name , p . x,    \nDon't: life as usual, yourAnswerIs    \nThis is version 1.0 of A Python Style Guide, found at [http://www.cs.williams.edu/](http://www.cs.williams.edu/) ~bailey/pyStyle.pdf.  \nSpaces, tabs, and end-of-line marks (collectively called, whitespace) are used, as in writing, to delimit words and phrases. In Python, whitespace also plays an important role in structuring programs.  \nRule 3 .1 Indent consistently using only spaces.  \nPython uses consistent indentation to identify suites of related statements. Python treats tab characters as subtly di􀀋erent than spaces. Some editors may attempt to substitute several spaces with a single tab. This worries Python, which will warn of inconsistent indentation.  \nTip: emacs: set the variable indent-tabs-mode to nil to ensure correct behavior.  \nRule 3.2 Use blank lines to separate definitions. Use blank lines, sparingly, within definitions. Blank lines help the reader identify the start of a new de􀀌nition. Unused lines can also break longer suites of statements into logical parts. Multiple, adjacent blank lines, however, tend to make de􀀌nitions appear scattered.  \nRule 3 .3 Use spaces as you would with human language punctuation.  \nSpaces and punctuation in programs serve a similar purpose to punctuation in human language. Use single spaces to separate conceptual units of the program, but do","cbCaiarrIvMcMVev","https://ap.wps.com/l/cbCaiarrIvMcMVev","pdf",154372,11,"English","# Introduction\n# Rules Overview\n## Rule 1: Use only Python version 3\n## Rule 2: Naming conventions\n### Rule 2.1 Limit name characters\n### Rule 2.2 Use meaningful names\n### Rule 2.3 Use camel case for multiword identifiers\n### Rule 2.4 Use underscores only for privacy/special variables\n## Rule 3: Whitespace, indentation, and formatting\n### Rule 3.1 Indent consistently with spaces\n### Rule 3.2 Use blank lines to separate definitions\n### Rule 3.3 Use spaces like human language punctuation\n### Rule 3.4 Place each statement on a dedicated line\n## Rule 4: Line and string conventions\n### Rule 4.1 Limit lines to 80 characters","[{\"question\":\"Why does the guide emphasize “beautiful” algorithm implementations?\",\"answer\":\"It argues that programs are appreciated through what readers can understand. Good language practices make it easier to express ideas as code and improve human communication.\"},{\"question\":\"What does Rule 1 require for Python version?\",\"answer\":\"Use only Python version 3, because Python 2 lacks features the guide depends on for scalable and correct programs.\"},{\"question\":\"How should identifiers be named according to Rule 2?\",\"answer\":\"Use only alphabetic and numeric characters, choose meaningful names, apply camelCase for multiword identifiers, and use underscores only for private or special variables with specific conventions.\"}]","A Python Style Guide - Draft | PDF",28,[146,150],{"page_no":8,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/05f63fc2b54a29396d93229ff9fb831a.webp",983,1272,{"page_no":14,"url":151,"width":152,"height":153},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-06/23bbf5de80b48128dba8f8347dd6b799.webp",982,1270,{"list":155,"token":66},[156,162,168,174,180,186,192,199,205,211],{"doc_id":157,"doc_title":158,"file_type":137,"home_preview_img_url":159,"slug":160,"view_count":81,"category_name":30,"create_tm":161},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=1796111939&Signature=RtmRne64D4V4WQDBkN9WxYqa1kg%3D","python-code-style-guide-introduction-format-and-use-of-white-space",1793963005,{"doc_id":163,"doc_title":164,"file_type":137,"home_preview_img_url":165,"slug":166,"view_count":34,"category_name":30,"create_tm":167},692314,"CS 116 Course Specific Style Guide - Document","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230003205286/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=mOoBkOvfd6THaIXy2UNOZWiw2G8%3D","cs-116-course-specific-style-guide-document",1794193120,{"doc_id":169,"doc_title":170,"file_type":137,"home_preview_img_url":171,"slug":172,"view_count":44,"category_name":30,"create_tm":173},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=1796111939&Signature=lBWOcHuzCOp%2Ft9uEHZL33GlKQQM%3D","python-quick-guide-beginner-start-here",1794186385,{"doc_id":175,"doc_title":176,"file_type":137,"home_preview_img_url":177,"slug":178,"view_count":29,"category_name":30,"create_tm":179},682220,"Style Guide for CS 231 and CS 234 - Python Style Requirements","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229998448640/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=o5EouvTNs4UP7RCXmkOrR3LeKQw%3D","style-guide-for-cs-231-and-cs-234-python-style-requirements",1793963013,{"doc_id":181,"doc_title":182,"file_type":137,"home_preview_img_url":183,"slug":184,"view_count":24,"category_name":30,"create_tm":185},670915,"Python Cheat Sheet - Quick Reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229988353347/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=QxojVeeNeEz%2FFntOTycjJL%2Bmjj0%3D","python-cheat-sheet-quick-reference-670915",1793572692,{"doc_id":187,"doc_title":188,"file_type":137,"home_preview_img_url":189,"slug":190,"view_count":24,"category_name":30,"create_tm":191},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=1796111939&Signature=eNdpda5LBdROyDtjPWvL22MJIlU%3D","python-pep8-the-style-guide-for-python-code",1793963024,{"doc_id":193,"doc_title":194,"file_type":137,"home_preview_img_url":195,"slug":196,"view_count":197,"category_name":30,"create_tm":198},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=1796111939&Signature=APf1Avtr7TJWO5jCHB6WgqdRLhg%3D","python-interview-questions-list-vs-tuples-key-features",15,1790350253,{"doc_id":200,"doc_title":201,"file_type":137,"home_preview_img_url":202,"slug":203,"view_count":29,"category_name":30,"create_tm":204},687604,"GNU nano - small and friendly text editor","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230001262810/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=KNzpQiUBUWPMKH9mPJwvy40ehUc%3D","gnu-nano-small-and-friendly-text-editor",1794084263,{"doc_id":206,"doc_title":207,"file_type":137,"home_preview_img_url":208,"slug":209,"view_count":144,"category_name":30,"create_tm":210},45838,"Implementing Programming Languages An Introduction to Compilers and Interpreters","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229797748707/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=2uZVuUpiS9hBQ17axHd0NRU%2B6iw%3D","implementing-programming-languages-an-introduction-to-compilers-and-interpreters",1783467164,{"doc_id":212,"doc_title":213,"file_type":137,"home_preview_img_url":214,"slug":215,"view_count":29,"category_name":30,"create_tm":216},670918,"The Python Cheat Sheet - Quick Reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229988353374/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=gKypxRzDW2SR5bnbyBIHA5Qicv4%3D","the-python-cheat-sheet-quick-reference",1793572702]