{"id":1444,"date":"2020-05-03T11:35:26","date_gmt":"2020-05-02T23:35:26","guid":{"rendered":"http:\/\/p-s.co.nz\/wordpress\/?p=1444"},"modified":"2020-06-08T10:05:19","modified_gmt":"2020-06-07T22:05:19","slug":"why-superhelp-for-python","status":"publish","type":"post","link":"http:\/\/p-s.co.nz\/wordpress\/why-superhelp-for-python\/","title":{"rendered":"Why SuperHELP for Python?"},"content":{"rendered":"\n<p>I created SuperHELP to make it easier for people to write good Python code. You can find the project at <a href=\"https:\/\/pypi.org\/project\/superhelp\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/pypi.org\/project\/superhelp\/<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/p-s.co.nz\/wordpress\/wp-content\/uploads\/2020\/05\/superhelp_logo.png\" alt=\"SuperHELP logo\" class=\"wp-image-1449\" width=\"203\" height=\"184\"\/><\/figure>\n\n\n\n<p>To summarise the rationale for SuperHELP I have thought of a few taglines:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>SuperHELP &#8211; Python help that really helps!<\/p><\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>SuperHELP &#8211; Help for Humans!<\/p><\/blockquote>\n\n\n\n<p>and even<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>SuperHELP &#8211; Make Python Pythonic!<\/p><\/blockquote>\n\n\n\n<p>Some context might help explain:<\/p>\n\n\n\n<p>Python has secured its position in the top tier of programming languages and more people than ever are learning to write Python. But, let&#8217;s be honest, a lot of Python code being written is not what it could be. Even an elegant language like Python can be written badly or in a way that is hard to read or maintain.<\/p>\n\n\n\n<p>To make it easier for people to write good Python we are already well-served by IDEs from IDLE upwards. People have easy access to style linters and IDEs clearly signal syntax errors and basic mistakes like unused variables. But wouldn&#8217;t it be great if people could check their code to see if there are better, more Pythonic ways of doing things? Or to learn more about basic language features and Python data structures than the standard help can offer?<br><br>That&#8217;s where SuperHELP can play a role.<\/p>\n\n\n\n<p>So what exactly is SuperHELP? Basically it is an advice engine. SuperHELP reads a snippet of Python and provides advice, warnings, and basic information based on what it finds. For example, it might notice a function docstring is missing and show a template for adding one. Or identify the use of a named tuple and explain how to add docstrings to individual fields or the named tuple as a whole.<\/p>\n\n\n\n<p>The intention is to make sure that everyone, from beginners upwards, learns something useful. Even an advanced Python programmer might not appreciate the benefits of using functools.wraps when creating their own decorator. Or an experienced Java programmer might not realise that Python properties are a much better option than getters and setters.<\/p>\n\n\n\n<p>So how can people use SuperHELP? For most people, the easiest way will be to open a binder web notebook and enter their code there.<\/p>\n\n\n\n<a href=\"https:\/\/mybinder.org\/v2\/git\/https%3A%2F%2Fgit.nzoss.org.nz%2FpyGrant%2Fsuperhelp.git\/master?filepath=notebooks%2FSuperhelpDemo.ipynb\" rel=\"nofollow\"><img decoding=\"async\" alt=\"Binder\" src=\"https:\/\/warehouse-camo.ingress.cmh1.psfhosted.org\/85e91bbb928104e4ce317951541520c6b9c170e1\/68747470733a2f2f6d7962696e6465722e6f72672f62616467655f6c6f676f2e737667\"><\/a>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"658\" src=\"http:\/\/p-s.co.nz\/wordpress\/wp-content\/uploads\/2020\/05\/example_notebook_output_1-1024x658.png\" alt=\"\" class=\"wp-image-1446\" srcset=\"http:\/\/p-s.co.nz\/wordpress\/wp-content\/uploads\/2020\/05\/example_notebook_output_1-1024x658.png 1024w, http:\/\/p-s.co.nz\/wordpress\/wp-content\/uploads\/2020\/05\/example_notebook_output_1-300x193.png 300w, http:\/\/p-s.co.nz\/wordpress\/wp-content\/uploads\/2020\/05\/example_notebook_output_1-768x494.png 768w, http:\/\/p-s.co.nz\/wordpress\/wp-content\/uploads\/2020\/05\/example_notebook_output_1-467x300.png 467w, http:\/\/p-s.co.nz\/wordpress\/wp-content\/uploads\/2020\/05\/example_notebook_output_1.png 1170w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Of course, because SuperHELP is a pip package <a rel=\"noreferrer noopener\" href=\"https:\/\/pypi.org\/project\/superhelp\/\" target=\"_blank\">https:\/\/pypi.org\/project\/superhelp\/<\/a> it can be installed alongside Python on a machine and used directly from the terminal e.g.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>shelp --code \"people = &#91;'Tomas', 'Sal']\" --output html --detail-level Main<\/code><\/pre>\n\n\n\n<p>If the output chosen is html (the default) output looks like:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"904\" height=\"880\" src=\"http:\/\/p-s.co.nz\/wordpress\/wp-content\/uploads\/2020\/05\/example_html_output_1-1.png\" alt=\"\" class=\"wp-image-1447\" srcset=\"http:\/\/p-s.co.nz\/wordpress\/wp-content\/uploads\/2020\/05\/example_html_output_1-1.png 904w, http:\/\/p-s.co.nz\/wordpress\/wp-content\/uploads\/2020\/05\/example_html_output_1-1-300x292.png 300w, http:\/\/p-s.co.nz\/wordpress\/wp-content\/uploads\/2020\/05\/example_html_output_1-1-768x748.png 768w, http:\/\/p-s.co.nz\/wordpress\/wp-content\/uploads\/2020\/05\/example_html_output_1-1-308x300.png 308w\" sizes=\"(max-width: 904px) 100vw, 904px\" \/><\/figure>\n\n\n\n<p>And if &#8211;output cli (command line interface i.e. terminal or console) is selected, output looks like:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"673\" height=\"992\" src=\"http:\/\/p-s.co.nz\/wordpress\/wp-content\/uploads\/2020\/05\/example_terminal_output_1.png\" alt=\"\" class=\"wp-image-1448\" srcset=\"http:\/\/p-s.co.nz\/wordpress\/wp-content\/uploads\/2020\/05\/example_terminal_output_1.png 673w, http:\/\/p-s.co.nz\/wordpress\/wp-content\/uploads\/2020\/05\/example_terminal_output_1-204x300.png 204w\" sizes=\"(max-width: 673px) 100vw, 673px\" \/><\/figure>\n\n\n\n<p>In all likelihood, there will be other ways of making SuperHELP advice more readily available &#8211; probably through integration with other platforms and processes.<\/p>\n\n\n\n<p>SuperHELP needs <strong>your<\/strong> help:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>If you have any ideas, or the ability to help in some way, please contact me at superhelp@p-s.co.nz.<\/li><li>Spread the word about SuperHELP through your social networks.<\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I created SuperHELP to make it easier for people to write good Python code. You can find the project at https:\/\/pypi.org\/project\/superhelp\/ To summarise the rationale for SuperHELP I have thought of a few taglines: SuperHELP &#8211; Python help that really &hellip; <a href=\"http:\/\/p-s.co.nz\/wordpress\/why-superhelp-for-python\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,11,3],"tags":[17,16,18,15],"class_list":["post-1444","post","type-post","status-publish","format-standard","hentry","category-open-source","category-programming","category-python","tag-education","tag-help","tag-programming","tag-python"],"_links":{"self":[{"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/posts\/1444"}],"collection":[{"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/comments?post=1444"}],"version-history":[{"count":3,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/posts\/1444\/revisions"}],"predecessor-version":[{"id":1462,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/posts\/1444\/revisions\/1462"}],"wp:attachment":[{"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/media?parent=1444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/categories?post=1444"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/tags?post=1444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}