{"id":384,"date":"2018-06-07T09:46:40","date_gmt":"2018-06-07T09:46:40","guid":{"rendered":"http:\/\/blog.amt.in\/?p=384"},"modified":"2018-06-07T09:46:40","modified_gmt":"2018-06-07T09:46:40","slug":"introduction-to-python","status":"publish","type":"post","link":"https:\/\/blog.amt.in\/index.php\/2018\/06\/07\/introduction-to-python\/","title":{"rendered":"Introduction to Python"},"content":{"rendered":"<p>Python\u00c2\u00a0is an\u00c2\u00a0interpreted\u00c2\u00a0high-level programming language\u00c2\u00a0for\u00c2\u00a0general-purpose programming.\u00c2\u00a0Python is a\u00c2\u00a0multi-paradigm programming language.\u00c2\u00a0Object-oriented programming\u00c2\u00a0and\u00c2\u00a0structured programming\u00c2\u00a0are fully supported, and many of its features support\u00c2\u00a0functional programming\u00c2\u00a0and\u00c2\u00a0aspect-oriented programming\u00c2\u00a0(including by\u00c2\u00a0meta-programming\u00c2\u00a0and\u00c2\u00a0meta-objects\u00c2\u00a0(magic methods)).\u00c2\u00a0Many other paradigms are supported via extensions, including\u00c2\u00a0design by contract\u00c2\u00a0and\u00c2\u00a0logic programming.<\/p>\n<p>Python uses\u00c2\u00a0dynamic typing, and a combination of\u00c2\u00a0reference counting\u00c2\u00a0and a cycle-detecting garbage collector for\u00c2\u00a0memory management. It also features dynamic\u00c2\u00a0name resolution(late binding), which binds method and variable names during program execution.<\/p>\n<p>Python&#8217;s design offers some support for\u00c2\u00a0functional programming\u00c2\u00a0in the\u00c2\u00a0Lisp\u00c2\u00a0tradition. It has\u00c2\u00a0<code>filter()<\/code>,\u00c2\u00a0<code>map()<\/code>, and\u00c2\u00a0<code>reduce()<\/code>\u00c2\u00a0functions;\u00c2\u00a0list comprehensions,\u00c2\u00a0dictionaries, and sets; and\u00c2\u00a0generator\u00c2\u00a0expressions.\u00c2\u00a0The standard library has two modules (itertools and functools) that implement functional tools borrowed from\u00c2\u00a0Haskell\u00c2\u00a0and\u00c2\u00a0Standard ML.<\/p>\n<p>The language&#8217;s core philosophy is summarized in the document\u00c2\u00a0The\u00c2\u00a0Zen of Python\u00c2\u00a0(PEP 20), which includes\u00c2\u00a0aphorisms\u00c2\u00a0such as:<\/p>\n<ul>\n<li>Beautiful is better than ugly<\/li>\n<li>Explicit is better than implicit<\/li>\n<li>Simple is better than complex<\/li>\n<li>Complex is better than complicated<\/li>\n<li>Readability counts<\/li>\n<\/ul>\n<p>Rather than having all of its functionality built into its core, Python was designed to be highly extensible. This compact modularity has made it particularly popular as a means of adding programmable interfaces to existing applications. Van Rossum&#8217;s vision of a small core language with a large standard library and easily extensible interpreter stemmed from his frustrations with\u00c2\u00a0ABC, which espoused the opposite approach.<\/p>\n<p>While offering choice in coding methodology, the Python philosophy rejects exuberant syntax (such as that of\u00c2\u00a0Perl) in favor of a simpler, less-cluttered grammar. As\u00c2\u00a0Alex Martelli\u00c2\u00a0put it: &#8220;To describe something as &#8216;clever&#8217; is\u00c2\u00a0<i>not<\/i>\u00c2\u00a0considered a compliment in the Python culture.&#8221;\u00c2\u00a0Python&#8217;s philosophy rejects the Perl &#8220;there is more than one way to do it&#8221; approach to language design in favor of &#8220;there should be one\u00e2\u20ac\u201dand preferably only one\u00e2\u20ac\u201dobvious way to do it&#8221;.<\/p>\n<p>Python&#8217;s developers strive to avoid\u00c2\u00a0premature optimization, and reject patches to non-critical parts of C Python that would offer marginal increases in speed at the cost of clarity.When speed is important, a Python programmer can move time-critical functions to extension modules written in languages such as C, or use\u00c2\u00a0PyPy, a\u00c2\u00a0just-in-time compiler.\u00c2\u00a0Cython\u00c2\u00a0is also available, which translates a Python script into C and makes direct C-level API calls into the Python interpreter.<\/p>\n<p>An important goal of Python&#8217;s developers is keeping it fun to use. This is reflected in the language&#8217;s name\u00e2\u20ac\u201da tribute to the British comedy group\u00c2\u00a0Monty Python\u00e2\u20ac\u201dand in occasionally playful approaches to tutorials and reference materials, such as examples that refer to spam and eggs (from a\u00c2\u00a0famous Monty Python sketch) instead of the standard\u00c2\u00a0foo and bar.<\/p>\n<p>A common\u00c2\u00a0neologism\u00c2\u00a0in the Python community is\u00c2\u00a0pythonic, which can have a wide range of meanings related to program style. To say that code is pythonic is to say that it uses Python idioms well, that it is natural or shows fluency in the language, that it conforms with Python&#8217;s minimalist philosophy and emphasis on readability. In contrast, code that is difficult to understand or reads like a rough transcription from another programming language is called\u00c2\u00a0unpythonic.<\/p>\n<p>Users and admirers of Python, especially those considered knowledgeable or experienced, are often referred to as\u00c2\u00a0Pythonists,\u00c2\u00a0Pythonistas, and\u00c2\u00a0Pythoneers.<\/p>\n<p>The above is a brief about Python compiled from various sites. Watch this space for more updates on the latest trends in Technology.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python\u00c2\u00a0is an\u00c2\u00a0interpreted\u00c2\u00a0high-level programming language\u00c2\u00a0for\u00c2\u00a0general-purpose programming.\u00c2\u00a0Python<\/p>\n","protected":false},"author":1,"featured_media":385,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[154,153],"tags":[156,155],"class_list":["post-384","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming-language","category-python","tag-programming-language","tag-python"],"_links":{"self":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/384","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/comments?post=384"}],"version-history":[{"count":1,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/384\/revisions"}],"predecessor-version":[{"id":386,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/384\/revisions\/386"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media\/385"}],"wp:attachment":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media?parent=384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/categories?post=384"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/tags?post=384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}