<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Senthil Kumaran (Posts about python)</title><link>http://senthil.learntosolveit.com/</link><description></description><atom:link href="http://senthil.learntosolveit.com/categories/python.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><lastBuildDate>Mon, 12 Oct 2026 02:53:51 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>fortune</title><link>http://senthil.learntosolveit.com/posts/2025/06/10/fortune.html</link><dc:creator>Senthil Kumaran</dc:creator><description>&lt;p&gt;A minimalist browser extension that displays a new quote in the browser tab. For example, when you open a new tab, you will see quotes like this:&lt;/p&gt;
&lt;hr class="docutils"&gt;
&lt;p&gt;&lt;em&gt;"And this is aviation; I give it to the world."&lt;/em&gt;  - &lt;em&gt;Louis Mouillard, French Inventor/Aeronaut (1834-1897)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;"We were on the point of abandoning our work when the book of Mouillard fell into our hands, and we continued with the results you know."&lt;/em&gt; - &lt;em&gt;Wilbur Wright, American Inventor/Aviator (1867-1921)&lt;/em&gt;&lt;/p&gt;
&lt;hr class="docutils"&gt;
&lt;p&gt;This extension is named after popular Unix Program 
        &lt;span class="wikipedia_tooltip"&gt;&lt;a href="https://en.wikipedia.org/wiki/Fortune_(Unix)" target="_blank"&gt;Fortune_(Unix)&lt;/a&gt;
            &lt;span class="wikipedia_summary"&gt;
            &lt;a href="https://en.wikipedia.org/wiki/Fortune_(Unix)" target="_blank" class="wikipedia_wordmark"&gt;
              &lt;img src="https://upload.wikimedia.org/wikipedia/commons/b/bb/Wikipedia_wordmark.svg"&gt;
              &lt;span class="wikipedia_icon"&gt;&lt;/span&gt;
            &lt;/a&gt;
            fortune is a program that displays a pseudorandom message from a database of quotations.
            &lt;/span&gt;
        &lt;/span&gt;, a command line utility which displays quotes in the shell. The browser with tabs is a modern shell interface of the computer. And this is the fortune program for the browser.&lt;/p&gt;
&lt;section id="technical-details"&gt;
&lt;h2&gt;Technical Details&lt;/h2&gt;
&lt;p&gt;I developed this with Python hosted on Google App Engine, and the client side written using Javascript as a browser addon. In the backend there is a database where I keep the quote and author in a table. There is API call that returns the quote and the author in the JSON format. To call the API visit &lt;a class="reference external" href="http://quotes-1271.appspot.com/json"&gt;http://quotes-1271.appspot.com/json&lt;/a&gt; . This is an unauthenticated API as it read-only GET call, and cannot change the state of the system.&lt;/p&gt;
&lt;p&gt;The client side is entirely handled by Javascript, and it displays the quote using simple 
        &lt;span class="wikipedia_tooltip"&gt;&lt;a href="https://en.wikipedia.org/wiki/Document_Object_Model" target="_blank"&gt;Document_Object_Model&lt;/a&gt;
            &lt;span class="wikipedia_summary"&gt;
            &lt;a href="https://en.wikipedia.org/wiki/Document_Object_Model" target="_blank" class="wikipedia_wordmark"&gt;
              &lt;img src="https://upload.wikimedia.org/wikipedia/commons/b/bb/Wikipedia_wordmark.svg"&gt;
              &lt;span class="wikipedia_icon"&gt;&lt;/span&gt;
            &lt;/a&gt;
            The Document Object Model (DOM) is a cross-platform and language-independent API that treats an HTML or XML document as a tree structure wherein each node is an object representing a part of the document. The DOM represents a document with a logical tree. Each branch of the tree ends in a node, and each node contains objects. DOM methods allow programmatic access to the tree; with them one can change the structure, style or content of a document. Nodes can have event handlers (also known as event listeners) attached to them. Once an event is triggered, the event handlers get executed.
            &lt;/span&gt;
        &lt;/span&gt; manipulation.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="get-the-extension-directly-from-the-webstore"&gt;
&lt;h2&gt;Get the extension directly from the webstore&lt;/h2&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://chromewebstore.google.com/detail/fortune/kmcoofcbagjmlfbkoopfohngcnfnaakb"&gt;Google Chrome Extension&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://addons.mozilla.org/en-US/firefox/addon/fortune-browser-extension/"&gt;Firefox Addons&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;section id="screenshot"&gt;
&lt;h2&gt;Screenshot&lt;/h2&gt;
&lt;img alt="screenshot" src="https://i.imgur.com/qLlqW7t.png"&gt;
&lt;/section&gt;
&lt;section id="video-demo"&gt;
&lt;h2&gt;Video Demo&lt;/h2&gt;
&lt;a class="reference external image-reference" href="http://www.youtube.com/watch?v=3S8b3eROxUY"&gt;
&lt;img alt="Demo" src="http://img.youtube.com/vi/3S8b3eROxUY/0.jpg"&gt;
&lt;/a&gt;
&lt;/section&gt;</description><category>browserextension</category><category>javascript</category><category>python</category><guid>http://senthil.learntosolveit.com/posts/2025/06/10/fortune.html</guid><pubDate>Wed, 11 Jun 2025 04:36:11 GMT</pubDate></item><item><title>Text Editor in Python with tkinter</title><link>http://senthil.learntosolveit.com/posts/2025/05/20/text-editor-in-python-with-tkinter.html</link><dc:creator>Senthil Kumaran</dc:creator><description>&lt;p&gt;Writing a simple text editor is a great starter project. Even after learning the
language and libraries, it is still a challenging task.  And as project it is
usable and relable one for any programmer, as we always deal with the text.&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="https://github.com/orsenthil/first-texteditor"&gt;https://github.com/orsenthil/first-texteditor&lt;/a&gt; is a very simple text editor that I wrote with Python, Tkinter.&lt;/p&gt;
&lt;p&gt;It is usable, and is a great start to write any other text editor with a different language.&lt;/p&gt;</description><category>gui</category><category>python</category><category>text-editor</category><category>tkinter</category><guid>http://senthil.learntosolveit.com/posts/2025/05/20/text-editor-in-python-with-tkinter.html</guid><pubDate>Tue, 20 May 2025 17:24:05 GMT</pubDate></item><item><title>CPython moved to Github</title><link>http://senthil.learntosolveit.com/posts/2017/02/20/cpython-moved-to-github.html</link><dc:creator>Senthil Kumaran</dc:creator><description>&lt;p&gt;CPython project moved it's source code hosting from self-hosted mercurial repository, at hg.python.org to Git
version control system hosted at Github. The new location of python project is &lt;a class="reference external" href="http://www.github.com/python/cpython"&gt;http://www.github.com/python/cpython&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is second big version control migration that is happening since I got involved. The first one was when
we moved from svn to mercurial. Branches were sub-optimal in svn and we used svn-merge.py to merge across
branches. Mercurial helped there and everyone got used to a distributed version control written in python,
mercurial. It was interesting for me personally to compare mercurial with the other popular DVCS, git.&lt;/p&gt;
&lt;p&gt;Over the years, Github has become popular place for developers to host their
projects. They have constantly improved their service offering. Many python
developers, got used to git version control system and found it's utility value too.&lt;/p&gt;
&lt;p&gt;Two years ago, it was decided that Python will move to Git and Github. The &lt;a class="reference external" href="https://paper.dropbox.com/doc/CPython-workflow-changes-mx1k8G6M0rg5JLy80F1r6"&gt;effort was led by
Bret Cannon&lt;/a&gt;  assisted by number of other developers and the migration happened on Feb 10, 2017.&lt;/p&gt;
&lt;p&gt;I helped with the migration too and helped with providing tool around converting the hg to git, using the facilities
available from hg-git mercurial plugin.&lt;/p&gt;
&lt;p&gt;We made use hg-git, and wrote some conversions scripts that could get us to the converted repo as we wanted.&lt;/p&gt;
&lt;ol class="arabic simple"&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://github.com/orsenthil/cpython-hg-to-git"&gt;https://github.com/orsenthil/cpython-hg-to-git&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://bitbucket.org/orsenthil/hg-git"&gt;https://bitbucket.org/orsenthil/hg-git&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Now that the migration is done, we are getting ourselves familiar to the new workflow.&lt;/p&gt;</description><category>python</category><guid>http://senthil.learntosolveit.com/posts/2017/02/20/cpython-moved-to-github.html</guid><pubDate>Mon, 20 Feb 2017 15:09:24 GMT</pubDate></item><item><title>Interactive Programming in Python</title><link>http://senthil.learntosolveit.com/posts/2013/12/29/interactive-programming-in-python.html</link><dc:creator>Senthil Kumaran</dc:creator><description>&lt;p&gt;This course involved writing games in Python. It was enjoyable. I undertook this
course along with my friend Avinash.&lt;/p&gt;
&lt;p&gt;https://www.coursera.org/learn/interactive-python-1&lt;/p&gt;</description><category>coursera</category><category>games</category><category>programming</category><category>python</category><guid>http://senthil.learntosolveit.com/posts/2013/12/29/interactive-programming-in-python.html</guid><pubDate>Sun, 29 Dec 2013 15:10:16 GMT</pubDate></item><item><title>Planning</title><link>http://senthil.learntosolveit.com/posts/2013/03/05/planning.html</link><dc:creator>Senthil Kumaran</dc:creator><description>&lt;p&gt;Since I like CS and I have not really cracked the Subject Test, I wanted give it a try again. Then I thought I will go through all the aduni.org videos that I have not watched and I have always wanted to watch. Then my thoughts lead me to stuff like topcoder, which I have not competed in for a while and trying to improving my ranking.&lt;/p&gt;&lt;p&gt;But at last, when clearing my Python emails, I saw so much of pending work that has accumulated that I want to work only on Python in a planned manner and not on anything else.&lt;/p&gt;</description><category>Planning.</category><category>python</category><guid>http://senthil.learntosolveit.com/posts/2013/03/05/planning.html</guid><pubDate>Wed, 06 Mar 2013 00:18:35 GMT</pubDate></item><item><title>Python Strings as Comments</title><link>http://senthil.learntosolveit.com/posts/2009/10/21/python-strings-as-comments.html</link><dc:creator>Senthil Kumaran</dc:creator><description>&lt;p&gt;The question was:&lt;/p&gt;
&lt;p&gt;In Python we can emulate multiline comments using triple-quoted
strings, but conceptually strings and comments are very different.
I.e. strings are objects, comments are auxillary text discarded at
compile time. Strings are objects created at runtime, comments are
not.&lt;/p&gt;
&lt;p&gt;The answer from Steven D'Aprano:&lt;/p&gt;
&lt;p&gt;Guido's time-machine strikes again.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nn"&gt;dis&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;     &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;     &lt;span class="s2"&gt;"""&lt;/span&gt;
&lt;span class="s2"&gt;...     This is a triple-quote comment.&lt;/span&gt;
&lt;span class="s2"&gt;...     """&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;dis&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;test&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="mi"&gt;2&lt;/span&gt;           &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="n"&gt;LOAD_CONST&lt;/span&gt;               &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
              &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="n"&gt;STORE_FAST&lt;/span&gt;               &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="mi"&gt;6&lt;/span&gt;           &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="n"&gt;LOAD_FAST&lt;/span&gt;                &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
              &lt;span class="mi"&gt;9&lt;/span&gt; &lt;span class="n"&gt;RETURN_VALUE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;String literals -- not just triple-quoted strings, but any string
literal -- that don't go anywhere are discarded by the Python compiler,
precisely so they can be used as comments.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;But docstrings are something else&lt;/p&gt;
&lt;p&gt;You would need to add specific options to python to stop it from byte-compiling docstrings though.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Anonymous&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Re: But docstrings are something else&lt;/p&gt;
&lt;p&gt;Sorry, for the late reply, I myself had do some experimentations to understand this stuff. In the above snippet as you saw, the compiler discards any string which is not referenced. But it is still available as a &lt;strong&gt;doc&lt;/strong&gt; attribute of the test object.&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt;&amp;gt; def test():&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt;&amp;gt; import dis&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt;&amp;gt; dis.dis(test)&lt;/p&gt;
&lt;p&gt;3           0 LOAD_CONST               1 (1)&lt;/p&gt;
&lt;p&gt;3 STORE_FAST               0 (x)&lt;/p&gt;
&lt;p&gt;4           6 LOAD_FAST                0 (x)&lt;/p&gt;
&lt;p&gt;9 RETURN_VALUE&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt;&amp;gt; print test.&lt;strong&gt;doc&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is string&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/p&gt;
&lt;p&gt;But create a python snippet 'foo.py' like this:&lt;/p&gt;
&lt;p&gt;def test():&lt;/p&gt;
&lt;p&gt;"""This is a docstring"""&lt;/p&gt;
&lt;p&gt;print test.&lt;strong&gt;doc&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;return True&lt;/p&gt;
&lt;p&gt;test()&lt;/p&gt;
&lt;p&gt;and do python foo.py vs python -OO foo.py you will see the .&lt;strong&gt;doc&lt;/strong&gt; attribute itself is discarded while doing optimization using -OO.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Senthil&lt;/em&gt;&lt;/p&gt;</description><category>comments</category><category>python</category><category>strings</category><guid>http://senthil.learntosolveit.com/posts/2009/10/21/python-strings-as-comments.html</guid><pubDate>Wed, 21 Oct 2009 13:29:00 GMT</pubDate></item><item><title>Greedy vs Non-Greedy in Re - Good Example</title><link>http://senthil.learntosolveit.com/posts/2008/12/28/greedy-vs-non-greedy-in-re-good-example.html</link><dc:creator>Senthil Kumaran</dc:creator><description>&lt;p&gt;Here is a good example to explain greedy vs, non-greedy search using module &lt;a href="http://docs.python.org/library/re.html"&gt;re&lt;/a&gt; in Python.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;*The&lt;span class="w"&gt; &lt;/span&gt;'\*',&lt;span class="w"&gt; &lt;/span&gt;'+',&lt;span class="w"&gt; &lt;/span&gt;and&lt;span class="w"&gt; &lt;/span&gt;'?'&lt;span class="w"&gt; &lt;/span&gt;qualifiers&lt;span class="w"&gt; &lt;/span&gt;are&lt;span class="w"&gt; &lt;/span&gt;all&lt;span class="w"&gt; &lt;/span&gt;greedy;&lt;span class="w"&gt; &lt;/span&gt;they&lt;span class="w"&gt; &lt;/span&gt;match&lt;span class="w"&gt; &lt;/span&gt;as&lt;span class="w"&gt; &lt;/span&gt;much&lt;span class="w"&gt; &lt;/span&gt;text&lt;span class="w"&gt; &lt;/span&gt;as&lt;span class="w"&gt; &lt;/span&gt;possible.&lt;span class="w"&gt; &lt;/span&gt;Sometimes&lt;span class="w"&gt; &lt;/span&gt;this&lt;span class="w"&gt; &lt;/span&gt;behaviour&lt;span class="w"&gt; &lt;/span&gt;isn't&lt;span class="w"&gt; &lt;/span&gt;desired;&lt;span class="w"&gt; &lt;/span&gt;if&lt;span class="w"&gt; &lt;/span&gt;the&lt;span class="w"&gt; &lt;/span&gt;RE&lt;span class="w"&gt; &lt;/span&gt;is&lt;span class="w"&gt; &lt;/span&gt;matched&lt;span class="w"&gt; &lt;/span&gt;against&lt;span class="w"&gt; &lt;/span&gt;'&lt;span class="nt"&gt;&amp;lt;H1&amp;gt;&lt;/span&gt;title&lt;span class="nt"&gt;&amp;lt;/H1&amp;gt;&lt;/span&gt;',&lt;span class="w"&gt; &lt;/span&gt;it&lt;span class="w"&gt; &lt;/span&gt;will&lt;span class="w"&gt; &lt;/span&gt;match&lt;span class="w"&gt; &lt;/span&gt;the&lt;span class="w"&gt; &lt;/span&gt;entire&lt;span class="w"&gt; &lt;/span&gt;string,&lt;span class="w"&gt; &lt;/span&gt;and&lt;span class="w"&gt; &lt;/span&gt;not&lt;span class="w"&gt; &lt;/span&gt;just&lt;span class="w"&gt; &lt;/span&gt;'&lt;span class="nt"&gt;&amp;lt;H1&amp;gt;&lt;/span&gt;'.&lt;span class="w"&gt; &lt;/span&gt;Adding&lt;span class="w"&gt; &lt;/span&gt;'?'&lt;span class="w"&gt; &lt;/span&gt;after&lt;span class="w"&gt; &lt;/span&gt;the&lt;span class="w"&gt; &lt;/span&gt;qualifier&lt;span class="w"&gt; &lt;/span&gt;makes&lt;span class="w"&gt; &lt;/span&gt;it&lt;span class="w"&gt; &lt;/span&gt;perform&lt;span class="w"&gt; &lt;/span&gt;the&lt;span class="w"&gt; &lt;/span&gt;match&lt;span class="w"&gt; &lt;/span&gt;in&lt;span class="w"&gt; &lt;/span&gt;non-greedy&lt;span class="w"&gt; &lt;/span&gt;or&lt;span class="w"&gt; &lt;/span&gt;minimal&lt;span class="w"&gt; &lt;/span&gt;fashion;&lt;span class="w"&gt; &lt;/span&gt;as&lt;span class="w"&gt; &lt;/span&gt;few&lt;span class="w"&gt; &lt;/span&gt;characters&lt;span class="w"&gt; &lt;/span&gt;as&lt;span class="w"&gt; &lt;/span&gt;possible&lt;span class="w"&gt; &lt;/span&gt;will&lt;span class="w"&gt; &lt;/span&gt;be&lt;span class="w"&gt; &lt;/span&gt;matched.&lt;span class="w"&gt; &lt;/span&gt;Using&lt;span class="w"&gt; &lt;/span&gt;.\*?&lt;span class="w"&gt; &lt;/span&gt;in&lt;span class="w"&gt; &lt;/span&gt;the&lt;span class="w"&gt; &lt;/span&gt;previous&lt;span class="w"&gt; &lt;/span&gt;expression&lt;span class="w"&gt; &lt;/span&gt;will&lt;span class="w"&gt; &lt;/span&gt;match&lt;span class="w"&gt; &lt;/span&gt;only&lt;span class="w"&gt; &lt;/span&gt;'&lt;span class="nt"&gt;&amp;lt;H1&amp;gt;&lt;/span&gt;'.*
&lt;/pre&gt;&lt;/div&gt;</description><category>pattern-matching</category><category>python</category><category>regex</category><guid>http://senthil.learntosolveit.com/posts/2008/12/28/greedy-vs-non-greedy-in-re-good-example.html</guid><pubDate>Sun, 28 Dec 2008 16:47:00 GMT</pubDate></item><item><title>Discussing English Grammar in the bug report.</title><link>http://senthil.learntosolveit.com/posts/2008/12/18/discussing-english-grammar-in-the-bug-report.html</link><dc:creator>Senthil Kumaran</dc:creator><description>&lt;p&gt;Follow the discussion in this Python Documentation &lt;a href="http://bugs.python.org/issue4243"&gt;bug report&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Its for correct usage of English and grammar.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Terry J. Reedy added the comment:&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Benjamin: I thank you too for verifying that I was not crazy.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Martin: I noticed native/non-native split too, and chalked it up to a subtle difference between German and English.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;For future reference, the problem with the original, as I see it now, is a subtle interaction between syntax and semantics. The original sentence combined two thoughts about has_key. The two should be either coordinate (parallel in form) or one should be clearly subordinate. A subordinate modifier should generally be closer to the subject, especially if it is much shorter. Making that so was one of my suggestions. The coordinate form would be 'but it is deprecated'. But this does not work because 'it' would be somewhat ambiguous because of the particular first modifier.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;The following pair of sentences illustrate what I am trying to say. Guido was once a Nederlander, but he moved to America. Guido was once a student of Professor X, but he moved to America.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;In English, the second 'he' is ambiguous because of the particular first modifier.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;So, to me, 'but deprecated' at the end of the sentence reads as either a misplaced subordinate form or as an abbreviated coordinate form that is at least somewhat ambiguous because of the meaning of the other modifier.&lt;/em&gt;&lt;/p&gt;</description><category>documentation</category><category>english</category><category>grammar</category><category>python</category><guid>http://senthil.learntosolveit.com/posts/2008/12/18/discussing-english-grammar-in-the-bug-report.html</guid><pubDate>Fri, 19 Dec 2008 05:02:00 GMT</pubDate></item><item><title>How identation works for Python programs?</title><link>http://senthil.learntosolveit.com/posts/2008/05/29/how-identation-works-for-python-programs.html</link><dc:creator>Senthil Kumaran</dc:creator><description>&lt;p&gt;It is well explained in &lt;a href="http://www.secnetix.de/~olli/Python/block_indentation.hawk"&gt;this article&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It is the lexical analyzer that takes care of the indentation and not the python parser. Lexical analyzer maintains a stack for the indentation.
1) First for no indentation, it would stored 0 in the stack [0]
2) Next when any Indentation occurs, it denotes it by token INDENT and pushes the indent value to the stack[0]. Think of it as a beinging { brace in the C program. And if we visualized, the can be only one INDENT statement per line.
4) When de-indent occurs in a line, as many values are popped out of the stack as the new reduced indentation till the value on the top of the stack is equal to new indentation (if not equal, error) and for each value popped out a DEDENT token in written. (Like multiple end }} in C)&lt;/p&gt;
&lt;p&gt;A simple code like this&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;x&lt;/span&gt;:
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;true&lt;/span&gt;:
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nv"&gt;print&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'yes'&lt;/span&gt;
&lt;span class="nv"&gt;print&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'end'&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Would be written as:&lt;/p&gt;
&lt;pre&gt;

`&lt;if&gt;&lt;x&gt;&amp;lt;:&amp;gt;`                           # Stack[0]
`&lt;indent&gt;&lt;if&gt;&lt;true&gt;&amp;lt;:&amp;gt;`  # Stack [0,4]
`&lt;indent&gt;&lt;print&gt;&amp;lt;'&amp;gt;&lt;yes&gt;&amp;lt;'&amp;gt;` # Stack [0,4,8]
`&lt;dedent&gt;&lt;dedent&gt;&lt;print&gt;&amp;lt;'&amp;gt;&lt;end&gt;&amp;lt;'&amp;gt;` #Stack[0]

&lt;/end&gt;&lt;/print&gt;&lt;/dedent&gt;&lt;/dedent&gt;&lt;/yes&gt;&lt;/print&gt;&lt;/indent&gt;&lt;/true&gt;&lt;/if&gt;&lt;/indent&gt;&lt;/x&gt;&lt;/if&gt;&lt;/pre&gt;

&lt;p&gt;The parser would just consider the  as &lt;indent&gt; as { of the block and  &lt;dedent&gt;  as } of the block would be able to parse it as logical blocks.&lt;/dedent&gt;&lt;/indent&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.secnetix.de/~olli/Python/block_indentation.hawk"&gt;That&lt;/a&gt; was a well written article again.&lt;/p&gt;</description><category>indentation</category><category>parsing</category><category>python</category><category>syntax</category><guid>http://senthil.learntosolveit.com/posts/2008/05/29/how-identation-works-for-python-programs.html</guid><pubDate>Fri, 30 May 2008 02:02:00 GMT</pubDate></item><item><title>Lambda functions</title><link>http://senthil.learntosolveit.com/posts/2007/11/14/lambda-functions.html</link><dc:creator>Senthil Kumaran</dc:creator><description>&lt;p&gt;I often forget the syntax and usage of 
        &lt;span class="wikipedia_tooltip"&gt;&lt;a href="https://en.wikipedia.org/wiki/Lambda_calculus" target="_blank"&gt;lambda functions&lt;/a&gt;
            &lt;span class="wikipedia_summary"&gt;
            &lt;a href="https://en.wikipedia.org/wiki/Lambda_calculus" target="_blank" class="wikipedia_wordmark"&gt;
              &lt;img src="https://upload.wikimedia.org/wikipedia/commons/b/bb/Wikipedia_wordmark.svg"&gt;
              &lt;span class="wikipedia_icon"&gt;&lt;/span&gt;
            &lt;/a&gt;
            In mathematical logic, the lambda calculus (also written as λ-calculus) is a formal system for expressing computation based on function abstraction and application using variable binding and substitution. Untyped lambda calculus, the topic of this article, is a universal machine, i.e. a model of computation that can be used to simulate any Turing machine (and vice versa). It was introduced by the mathematician Alonzo Church in the 1930s as part of his research into the foundations of mathematics. In 1936, Church found a formulation which was logically consistent, and documented it in 1940.
            &lt;/span&gt;
        &lt;/span&gt;, the following examples should help as a reminder.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;6&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;func_with_lambda&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;func_with_lambda&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;4&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;4&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;</description><category>functions</category><category>lambda</category><category>python</category><guid>http://senthil.learntosolveit.com/posts/2007/11/14/lambda-functions.html</guid><pubDate>Thu, 15 Nov 2007 01:42:00 GMT</pubDate></item></channel></rss>