<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Moderate Realism</title>
	<link>http://ramblings.timgolden.me.uk</link>
	<description>The ramblings of Tim Golden</description>
	<pubDate>Fri, 10 May 2013 07:27:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2</generator>
	<language>en</language>
			<item>
		<title>Just in case you thought it was easy&#8230;</title>
		<link>http://ramblings.timgolden.me.uk/2013/05/10/just-in-case-you-thought-it-was-easy/</link>
		<comments>http://ramblings.timgolden.me.uk/2013/05/10/just-in-case-you-thought-it-was-easy/#comments</comments>
		<pubDate>Fri, 10 May 2013 07:25:05 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python Core Development]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2013/05/10/just-in-case-you-thought-it-was-easy/</guid>
		<description><![CDATA[From time to time, the idea of a standard Python &#8220;Enum&#8221; object is raised on the Python lists. You know the kind of thing: a lightweight means of mapping numbers to labels so you can do set_colour(Colours.red) without having a long module of manifest constants or magic numbers lying around all over your codebase.
It all [...]]]></description>
			<content:encoded><![CDATA[<p>From time to time, the idea of a standard Python &#8220;Enum&#8221; object is raised on the Python lists. You know the kind of thing: a lightweight means of mapping numbers to labels so you can do set_colour(Colours.red) without having a long module of manifest constants or magic numbers lying around all over your codebase.</p>
<p>It all sounds very straightforward, and Barry Warsaw had <a href="http://pythonhosted.org/flufl.enum/">an existing module</a> which seemed like a fairly good starting point, so<a href="http://www.python.org/dev/peps/pep-0435/"> PEP 435</a> was started and it all looked like it was just a formality.</p>
<p>Now, literally *hundreds* of mailing list posts and endless, endless threads later, GvR has just <a href="http://mail.python.org/pipermail/python-dev/2013-May/126112.html">pronounced his approval</a> of the PEP and it&#8217;s good to go.</p>
<p>If you &#8212; like me &#8212; thought &#8220;this one won&#8217;t be controversial&#8221;, then just point your search engine of choice at mail.python.org/pipermail/python-dev and look for &#8220;enum&#8221; or &#8220;435&#8243;, or just look at the <a href="http://mail.python.org/pipermail/python-dev/2013-May/">archive for May</a> alone (which only represents the final few days of details being thrashed out) to realise just how much discussion and work is involved in what appears to be quite a simple thing.</p>
<p>Of course, part of the problem is precisely the fact that the idea is so simple. I&#8217;m sure most people have rolled their own version of something like this. I know I have. You can get up and running with a simple &#8220;bunch&#8221; class, possibly throw in a few convenience methods to map values to names and then just get on with life. But when something&#8217;s got to go into the stdlib then it all becomes a lot more difficult, because everyone has slightly (or very) different needs; and everyone has slightly (or very) different ideas about what constitutes the most convenient interface. </p>
<p>And there&#8217;s always the danger of the <a href="https://en.wikipedia.org/wiki/Parkinson's_law_of_triviality">&#8220;bikeshed&#8221; effect</a>. If a PEP is proposing something perhaps quite fundamental but outside most people&#8217;s experience, then only people with sufficient  interest and knowledge are likely to contribute. (Or argue). But an enum: everyone&#8217;s done that, and everyone&#8217;s got an interest, and an idea about how it should be done.</p>
<p>But, bikesheds aside, I&#8217;m glad that the Python community is prepared to refine its ideas to get the best possible solution into the standard library. As a developer, one naturally feels that one&#8217;s own ideas and needs represent everyone else&#8217;s. It&#8217;s only when you expose your ideas to the sometimes harsh winds of the community critique that you discover just how many different angles there are to something you thought was simple. </p>
<p>Thankfully, we have a BDFL (or, sometimes, a PEP Czar) to make the final decision. And, ultimately, that means that some people won&#8217;t see their needs being served in the way they want. But I think that that&#8217;s far preferable to a design-by-committee solution which tries to please everybody and ends up being cluttered.</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2013/05/10/just-in-case-you-thought-it-was-easy/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Yesterday&#8217;s London Python Dojo</title>
		<link>http://ramblings.timgolden.me.uk/2013/03/08/yesterdays-london-python-dojo/</link>
		<comments>http://ramblings.timgolden.me.uk/2013/03/08/yesterdays-london-python-dojo/#comments</comments>
		<pubDate>Fri, 08 Mar 2013 13:26:31 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2013/03/08/yesterdays-london-python-dojo/</guid>
		<description><![CDATA[Yesterday was the March Python Dojo, hosted as usual by the ever-generous Fry-IT, with a book donated by O&#8217;Reilly. We started with a couple of not-so lightning talks from Tom Viner &#8212; talking about his team&#8217;s solution for last month&#8217;s puzzle &#8212; and Nicholas Tollervey &#8212; talking about bittorrent. An artfully-worded late question had @ntoll [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday was the March Python Dojo, hosted as usual by the ever-generous <a href="http://www.fry-it.com/">Fry-IT</a>, with a book donated by <a href="http://oreilly.com/">O&#8217;Reilly</a>. We started with a couple of not-so lightning talks from Tom Viner &#8212; talking about <a href="https://github.com/ldnpydojo/slider-puzzle/tree/master/team2">his team&#8217;s solution</a> for last month&#8217;s puzzle &#8212; and Nicholas Tollervey &#8212; talking about bittorrent. An artfully-worded late question had @ntoll on his soapbox for a while on the subject of copyright and payment to artists, until someone spoiled it by suggesting that maybe we ought to write some code in Python!</p>
<p>After the usual, only slightly convoluted, voting experience, we decided to pick up one of last month&#8217;s runner-up challenges: creating a compression-decompression algorithm. Naturally most people started from some kind of frequency table, replacing the most common items with the smallest replacement. The approaches ranged from a hybrid Huffman-UTF8 encoding to an attempt to replace common words by a $n placeholder, where the n would increase as the word became less common. The winner for the most optimistic approach was a lossy algorithm which dropped every other word on compression, replacing it on decompression by the most likely from a lookup table. Tested against a corpus of Shakespeare&#8217;s works it produced some quite readable poetry.</p>
<p>As an aside, I can assert after a wide-ranging survey that (a) the preferred editor background is dark (black or dark-grey); and (b) in spite of all the tech at their fingertips, programmers still reach for pen and paper when they need to work something out!</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2013/03/08/yesterdays-london-python-dojo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Great Thing About Open Source Is&#8230;</title>
		<link>http://ramblings.timgolden.me.uk/2013/01/16/the-great-thing-about-open-source-is/</link>
		<comments>http://ramblings.timgolden.me.uk/2013/01/16/the-great-thing-about-open-source-is/#comments</comments>
		<pubDate>Wed, 16 Jan 2013 13:51:55 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2013/01/16/the-great-thing-about-open-source-is/</guid>
		<description><![CDATA[(No, this isn&#8217;t one of those New Year memes; it&#8217;s just a bit of a verbal ramble). 
I wanted to get an app up-and-running on WebFaction. And, for reasons not necessarily entirely connected with reality and hard requirements, I decided to go for Python3. WF offers CherryPy 3.2 against Python 3.1 but &#8212; again, for [...]]]></description>
			<content:encoded><![CDATA[<p>(No, this isn&#8217;t one of those New Year memes; it&#8217;s just a bit of a verbal ramble). </p>
<p>I wanted to get an app up-and-running on WebFaction. And, for reasons not necessarily entirely connected with reality and hard requirements, I decided to go for Python3. WF offers CherryPy 3.2 against Python 3.1 but &#8212; again, for no very good reason &#8212; I decided I wanted the very latest.</p>
<p>So: download cherrypy.latest.tgz and python.latest.tgz. Dum de dum, configure &#8211;prefix=$HOME &#038;&#038; make &#038;&#038; make install. Bit of fiddling about with WF&#8217;s cherrypy setup and&#8230; we have a problem. The cherrypy engine is, for some reason of its own, using threading._Timer rather than threading.Timer and it&#8217;s not there any more in Python 3.3.</p>
<p>Investigation shows that this was fixed in cherrypy <a href="https://bitbucket.org/cherrypy/cherrypy/src/01b6adcb3849/cherrypy/process/plugins.py">a few months ago</a>. Meanwhile things will probably go ok with Python 3.2. What to do? I decided on backtracking on Python (truth be told, I hadn&#8217;t checked the cherrypy logs at this point). Download python.32.tgz. Dum de dum&#8230; and&#8230; error with _posixsubprocess. Looks like it&#8217;s fixed in the 3.2 branch but not yet released.</p>
<p>I&#8217;m now in the situation where I&#8217;ll either have to use a hg checkout of cherrypy or an hg checkout of Python. Or both.</p>
<p>Lest this be seen as a dig at either the cherrypy or the Python guys, it&#8217;s certainly not. I&#8217;m grateful to them both for the work they&#8217;ve done and for the open source infrastructure they use which gives me the information and options I&#8217;ve outlined above. I could most certainly backtrack a couple of published versions of either perfectly well for my own needs.</p>
<p>It&#8217;s more of an endorsement of what open source offers you if you want (and I haven&#8217;t even talked about the fact that I could fork cherrypy or Python if I needed and still maintain a version in sync with the canonical one for my own use on WF).</p>
<p>All I need to do now is clone hg.python.org/cpython, config &#038; make and I&#8217;m away.</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2013/01/16/the-great-thing-about-open-source-is/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Aide-memoire for Python hg clones</title>
		<link>http://ramblings.timgolden.me.uk/2012/10/04/aide-memoire-for-python-hg-clones/</link>
		<comments>http://ramblings.timgolden.me.uk/2012/10/04/aide-memoire-for-python-hg-clones/#comments</comments>
		<pubDate>Thu, 04 Oct 2012 07:59:05 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python Core Development]]></category>

		<category><![CDATA[Aide-memoire]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2012/10/04/aide-memoire-for-python-hg-clones/</guid>
		<description><![CDATA[(This is because I use mercurial rarely enough and commit to Python even more rarely; so I always forget what incantations I used last time&#8230;)
hg clone http://hg.python.org/cpython hg.python.org
hg clone hg.python.org issue1234
cd issue1234
hg up 3.3
hg import &#8211;no-commit http://&#8230;/fixedit.patch
# Do whatever
hg commit -m &#8220;&#8230; (Patch by &#8230;)&#8221;
hg up default
hg import &#8211;no-commit http://&#8230;/fixedit.patch
# Do whatever
hg commit -m &#8220;&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>(This is because I use mercurial rarely enough and commit to Python even more rarely; so I always forget what incantations I used last time&#8230;)</p>
<p>hg clone http://hg.python.org/cpython hg.python.org<br />
hg clone hg.python.org issue1234<br />
cd issue1234</p>
<p>hg up 3.3<br />
hg import &#8211;no-commit http://&#8230;/fixedit.patch<br />
# Do whatever<br />
hg commit -m &#8220;&#8230; (Patch by &#8230;)&#8221;</p>
<p>hg up default<br />
hg import &#8211;no-commit http://&#8230;/fixedit.patch<br />
# Do whatever<br />
hg commit -m &#8220;&#8230; (Patch by &#8230;)&#8221;</p>
<p>hg push ssh://hg@hg.python.org/cpython</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2012/10/04/aide-memoire-for-python-hg-clones/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PyConUK 2012</title>
		<link>http://ramblings.timgolden.me.uk/2012/10/02/pyconuk-2012/</link>
		<comments>http://ramblings.timgolden.me.uk/2012/10/02/pyconuk-2012/#comments</comments>
		<pubDate>Tue, 02 Oct 2012 12:28:21 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2012/10/02/pyconuk-2012/</guid>
		<description><![CDATA[Well that was fun!
Four days of community-oriented Python. Talks, open spaces, sprints, teachers, Dojos, tubas&#8230; PyConUK 2012 had it all.
I won&#8217;t retail it all. You can look at the schedule or the videos for yourselves. A few things, though, merit a special mention.
First, the organisers and the venue both managed extremely well. It wasn&#8217;t without [...]]]></description>
			<content:encoded><![CDATA[<p>Well that was fun!</p>
<p>Four days of community-oriented Python. Talks, open spaces, sprints, teachers, Dojos, tubas&#8230; PyConUK 2012 had it all.</p>
<p>I won&#8217;t retail it all. You can look at the <a href="http://pyconuk.net/Schedule">schedule</a> or the <a href="http://autoview.autotrain.org/course/view.php?id=15">videos</a> for yourselves. A few things, though, merit a special mention.</p>
<p>First, the organisers and the venue both managed extremely well. It wasn&#8217;t without a few very slight issues, but the venue staff were professional and helpful and the Python West Midlands organisers made sure everything went to plan (adjusting the plan, if necessary!).</p>
<p>Second, the education track. This was a new venture as was fronted by <a href="https://twitter.com/ntoll">Nicholas Tollervey</a>, himself a former teacher and the prime mover of the London Python Dojo. (Note to self: really must do something about a ldnpydojo website&#8230;). We had ICT and other teachers who had a tutorial on the Saturday as an introduction to Python and a sprint on the Sunday with groups of developers to see how to translate technical know-how into practical education. I think most of them also joined the Saturday afternoon Dojo. The most enthusiastic was &#8220;<a href="http://www.ictwithmissp.co.uk/">Miss P</a>&#8221; who also participated in the PyConUK panel.</p>
<p>Then we had Alex Bradbury from the RaspberryPi foundation. He gave a keynote speech on the Saturday and led the very popular RPi sprint on Monday. He&#8217;s very enthusiastic about Python and the RPi and education and there was a lot of cross-discussion throughout the conference on those themes.</p>
<p>Finally among many lightning talks &#8212; ably compered, as always, by Lightning Talk Man himself &#8212; the standout was a performance on two tubas, playing the Sousa march which will be familiar to any Monty Python fan. I&#8217;m hoping someone has a picture of the performance which I can link to: the video doesn&#8217;t seem to be up yet.</p>
<p>A last shout-out to Tim, the video man, who stood patiently at the back of the main hall throughout the conference, recording every talk and panel, streaming it live and uploading very quickly with your slides synchronised in.</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2012/10/02/pyconuk-2012/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Python 3.3 is on the way</title>
		<link>http://ramblings.timgolden.me.uk/2012/07/02/python-33-is-on-the-way/</link>
		<comments>http://ramblings.timgolden.me.uk/2012/07/02/python-33-is-on-the-way/#comments</comments>
		<pubDate>Mon, 02 Jul 2012 11:05:31 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python Core Development]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2012/07/02/python-33-is-on-the-way/</guid>
		<description><![CDATA[You&#8217;ve probably seen the mailing list announcements and the tweets which declare that Python 3.3 is entering its beta stage. For core developers this means that no more features can be introduced into this version of Python (at least not without the connivance of the Release Manager: Georg Brandl). Bug fixes are still allowed &#8212; [...]]]></description>
			<content:encoded><![CDATA[<p>You&#8217;ve probably seen the mailing list announcements and the tweets which declare that Python 3.3 is entering its beta stage. For core developers this means that no more features can be introduced into this version of Python (at least not without the connivance of the Release Manager: Georg Brandl). Bug fixes are still allowed &#8212; which sometimes leads to rather creative labelling of changesets.</p>
<p>Have a look at the preliminary &#8220;<a href="http://docs.python.org/dev/whatsnew/3.3.html">What&#8217;s New?</a>&#8221; doc. </p>
<p>Up to now, Python core developers have been championing Python 3 over Python 2 largely on the basis of a significant amount of cleanups, rationalisation and cruft-clearing. Now all this is very good, but mostly pleases people who have to work with the underlying Python code &#038; data or who are fond of housekeeping. Clearly there have been other additions. (In fact the more I read through the &#8220;What&#8217;s New?&#8221; documents the more I realise that we&#8217;ve been doing something of a poor job of advertising our own achievements). But there hasn&#8217;t perhaps been anything which is really structurally groundbreaking.</p>
<p>Now we&#8217;ve got built-in virtual environment support, proper namespace packages, a much clearer OS exceptions hierarchy, and &#8212; at long last &#8212; a way of yielding from other iterators. (That thing where you had to loop over an iterator yielding its values: you can now just &#8220;yield from&#8221;). Any one of those alone is surely worth the entrance price. It&#8217;s actually starting to become attractive to use Python 3.x not just because it&#8217;s cleaned-up (on the moral highground but without much of a change of scenery) but because it&#8217;s got cool new features that I actually need (wow! look at that view).</p>
<p>To be sure there are literally hundreds of other small changes, ranging from one-off bugfixes to large-scale rewrites: bz2 has been rewritten from scratch; Brett Cannon&#8217;s finally achieved his objective of reimplementing the import mechanism in Python; Unicode support under the covers is cleaner and faster; the useful-but-slower decimal module is now useful-but-faster thanks to a version written in C, the indefatigable Stefan Krah getting the credit there. And after much bouncing around, Peter Moody&#8217;s ipaddress module is now integrated in the stdlib.</p>
<p>For Windows users, two significant changes have made it in (although they haven&#8217;t reached the What&#8217;s New? docs yet). One is the implementation of PEP 397 &#8212; a Python launcher for Windows, conceived by Mark Hammond, with implementation work by Vinay Sajip and worked up into its final form by Martin von Loewis. The other, implemented by Brian Curtin, is the addition of python.exe to the system PATH. This one is a long-standing gripe especially for novice users who can now just type &#8220;python&#8221; at the command prompt and get the latest version up. In fact, the PEP 397 launcher makes this perhaps less important but it&#8217;s still good to have the option there in the installer.</p>
<p>I&#8217;m trying to help along a <a href="http://bugs.python.org/issue14243">couple</a> of <a href="http://bugs.python.org/issue9035">changes</a> to the Win32 implementation of some os pieces under the guise of bugfixes, but even if I don&#8217;t get them past the eagle eye of the release manager, this&#8217;ll still be a version to look forward to.</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2012/07/02/python-33-is-on-the-way/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PEP8 it is, then</title>
		<link>http://ramblings.timgolden.me.uk/2012/04/09/pep8-it-is-then/</link>
		<comments>http://ramblings.timgolden.me.uk/2012/04/09/pep8-it-is-then/#comments</comments>
		<pubDate>Mon, 09 Apr 2012 13:58:01 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2012/04/09/pep8-it-is-then/</guid>
		<description><![CDATA[Thanks to everyone who commented on my previous PEP8-related posts. It&#8217;s been quite an eye-opener for me to see how many people felt strongly that PEP8-compliance was a real must-have, not just for core Python itself but for any Python project. My own use of Python just about predates PEP8 itself, and certainly predates its [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to everyone who commented on my previous PEP8-related posts. It&#8217;s been quite an eye-opener for me to see how many people felt strongly that PEP8-compliance was a real must-have, not just for core Python itself but for any Python project. My own use of Python just about predates PEP8 itself, and certainly predates its more widespread adoption within the community. And, while I was aware that it was a default recommendation for someone seeking style guidelines, I don&#8217;t think I&#8217;d appreciated just how wide and strong its uptake was.</p>
<p>Of the comments made to my previous posts, only one outright dismissed PEP8; several spoke neutrally, more or less echoing the sentiments I&#8217;d expressed; but the majority which expressed a clear opinion made it strongly advisable, not to say mandatory, to follow PEP8 for one&#8217;s own (published) work.</p>
<p>So I&#8217;ve decided to switch to near-PEP8 style. (Note that pretty much everyone and every project varies a little, most commonly on the line length issue). The two key points which seemed &#8212; startlingly, from my perspective &#8212; to bother people the most were the two-space indents and the space-before-brackets. If you cared to peruse my <a href="https://github.com/tjguk/winshell">winshell</a> &#038; <a href="https://github.com/tjguk/active_directory">active_directory</a> github repos, you&#8217;ll note that those are now in line with PEP8. Others will follow as and when.</p>
<p>You&#8217;re probably <em>not</em> surprised to hear me say that, having made the switch, I can&#8217;t understand how anyone can prefer the PEP8 style. If I&#8217;ve switched, it&#8217;s not because I&#8217;ve had a sudden aesthetic revelation which makes me wonder why I wasn&#8217;t using 4-space indents all along. Quite the reverse: for the life of me I can&#8217;t see why anyone would prefer it. Rather, it&#8217;s because I recognise the value of a commonly-held standard within a community. And because, when I weighed it up, there was no reason &#8212; beyond my own preferences &#8212; not to switch.</p>
<p>I&#8217;ve tweaked my SciTE options and added the PEP8 module to my test scripts, turning off certain of the checks and allowing for slightly longer lines. Let&#8217;s see what I feel about this in a month or so&#8217;s time.</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2012/04/09/pep8-it-is-then/feed/</wfw:commentRss>
		</item>
		<item>
		<title>More on PEP8</title>
		<link>http://ramblings.timgolden.me.uk/2012/03/29/more-on-pep8/</link>
		<comments>http://ramblings.timgolden.me.uk/2012/03/29/more-on-pep8/#comments</comments>
		<pubDate>Thu, 29 Mar 2012 19:39:44 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2012/03/29/more-on-pep8/</guid>
		<description><![CDATA[Well I certainly got some robust comments on my previous PEP8 post. A few people chimed on my side, so to speak. Someone else found it &#8220;discouraging&#8221; when faced with &#8220;non-compliant code&#8221;. But it was Luke who obviously felt most strongly about the matter, and it&#8217;s his points that I&#8217;m really addressing here.
First of all, [...]]]></description>
			<content:encoded><![CDATA[<p>Well I certainly got some robust comments on my previous PEP8 post. A few people chimed on my side, so to speak. Someone else found it &#8220;discouraging&#8221; when faced with &#8220;non-compliant code&#8221;. But it was Luke who obviously felt most strongly about the matter, and it&#8217;s his points that I&#8217;m really addressing here.</p>
<p>First of all, it seems that you&#8217;ve got me coming and going: on the one hand, I&#8217;m unreasonable to expect people to adopt my project&#8217;s style when contributing to it; but on the other I&#8217;m unreasonable if I expect to program the same way in every environment. Let me say again what I said in the previous post: if I contribute to, say, core Python, then I *do* expect to have to change my style to match the project guidelines. Likewise, if I contribute to Pyro &#8212; a fairly well-known Python project &#8212; then I use camelCase method names, because that&#8217;s what its maintainer uses. I don&#8217;t find that so very difficult and I doubt it anyone else does either. (Of course my &#8220;anyone else does&#8221; here is as anecdotal as the generalisations in Luke&#8217;s comments and can be treated the same way).</p>
<p>Luke&#8217;s basic point seems to be that all Python code *should* look the same, regardless of any other consideration, and that to do otherwise is not to be a team player, to indicate that you don&#8217;t care, and to leave open the suspicion that your code is of as poor quality as&#8230; well, your PEP8-ness. And I find that position far beyond what I consider reasonable. If that leaves me turning people away at the door then please write and tell me. Perhaps I&#8217;m being a single-minded curmudgeon on this issue, but I am honestly bemused at the idea that *all* Python code should follow what is, basically, one person&#8217;s preferences.</p>
<p>In short, I would be genuinely interested to hear from other people if they think that publishing Python code which follows a consistent style but which is not PEP8-compliant is that much of an issue. For them, for would-be contributors, or for the image of Python.</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2012/03/29/more-on-pep8/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PEP8? Or not?</title>
		<link>http://ramblings.timgolden.me.uk/2012/03/27/pep8-or-not/</link>
		<comments>http://ramblings.timgolden.me.uk/2012/03/27/pep8-or-not/#comments</comments>
		<pubDate>Tue, 27 Mar 2012 12:21:26 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2012/03/27/pep8-or-not/</guid>
		<description><![CDATA[From time to time someone comments on some code example I&#8217;ve produced (or, indeed, one of my published modules) and makes the point that the code is not PEP8-compliant. The most common complaints are that I use spaces before function-call brackets &#8212; spam (&#8221;foo&#8221;) rather than spam(&#8221;foo&#8221;) &#8212; and that I use 2-space indents rather [...]]]></description>
			<content:encoded><![CDATA[<p>From time to time someone comments on some code example I&#8217;ve produced (or, indeed, one of my published modules) and makes the point that the code is not <a href="http://www.python.org/dev/peps/pep-0008/">PEP8</a>-compliant. The most common complaints are that I use spaces before function-call brackets &#8212; spam (&#8221;foo&#8221;) rather than spam(&#8221;foo&#8221;) &#8212; and that I use 2-space indents rather than 4.</p>
<p>Since I&#8217;ve written pretty much the same answer whenever this has been raised, I thought I might as well write it here and then point people towards it.</p>
<p>PEP 8 is the Python project&#8217;s code style guideline. I quote from the opening paragraph: &#8220;This document gives coding conventions for the Python code comprising the standard library in the main Python distribution.&#8221;. It is <em>not</em> a guideline for every piece of Python code ever written by anyone. On the odd occasion that I contribute code to the Python core I naturally ensure that my code complies with PEPs 7 &#038; 8 for C &#038; Python code respectively.</p>
<p>I&#8217;ve been using the format described above for well over 25 years of coding on different platforms &#038; languages. Along with other aspects, it constitutes my personal &#8220;house style&#8221;. If anyone wished to contribute to any of my projects I would ask them to follow the same guidelines (or at least, not to complain when I reformatted their code to match my own).</p>
<p>FWIW I find the spam(&#8221;foo&#8221;) style cramped; no doubt some people find my spam (&#8221;foo&#8221;) style too loose. So be it. I&#8217;m genuinely astonished when people advocate 8-space indents (and I&#8217;d be a bit startled by 1-space indents). I find 4 spaces push the relevant code too far away too easily so I use 2 spaces. Barring manifest absurdities, such things are largely subjective.</p>
<p>So now you know: if you see code examples of mine, or are perusing <a href="https://github.com/tjguk">my source code</a>, be prepared for (gasp) non-PEP8 compliance!</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2012/03/27/pep8-or-not/feed/</wfw:commentRss>
		</item>
		<item>
		<title>winshell 0.6.1</title>
		<link>http://ramblings.timgolden.me.uk/2012/03/26/winshell-061/</link>
		<comments>http://ramblings.timgolden.me.uk/2012/03/26/winshell-061/#comments</comments>
		<pubDate>Mon, 26 Mar 2012 10:49:08 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2012/03/26/winshell-061/</guid>
		<description><![CDATA[In a fit of energy over the weekend, I added some basic Recycle Bin functionality to the winshell module. (And thanks to Steve Reiss for the suggestion and for ideas about convenience functions). As of version 0.6.1 you can now:

Iterate over items in the recycle bin
Determine what versions of a file there are in the [...]]]></description>
			<content:encoded><![CDATA[<p>In a fit of energy over the weekend, I added some basic Recycle Bin functionality to the <a href="http://pypi.python.org/pypi/winshell">winshell</a> module. (And thanks to Steve Reiss for the suggestion and for ideas about convenience functions). As of version 0.6.1 you can now:</p>
<ul>
<li>Iterate over items in the recycle bin</li>
<li>Determine what versions of a file there are in the recycle bin</li>
<li>Undelete the latest or a specific version of a file</li>
<li>Empty all recycle bins</li>
</ul>
<p>You could already delete <em>to</em> the Recycle Bin (via delete_file). Now you can undelete as well!</p>
<ul>
<li>pip install winshell</li>
<li>github: <a href="http://github.com/tjguk/winshell">http://github.com/tjguk/winshell</a></li>
<li>PyPI: <a href="http://pypi.python.org/pypi/winshell">http://pypi.python.org/pypi/winshell</a></li>
<li>readthedocs.org: <a href="http://readthedocs.org/docs/winshell/">http://readthedocs.org/docs/winshell/</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2012/03/26/winshell-061/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
