<?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>Mon, 16 Aug 2010 16:14:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2</generator>
	<language>en</language>
			<item>
		<title>I&#8217;m a Windows Person. How can I contribute to Python? [Part I]</title>
		<link>http://ramblings.timgolden.me.uk/2010/08/16/im-a-windows-person-how-can-i-contribute-to-python-part-i/</link>
		<comments>http://ramblings.timgolden.me.uk/2010/08/16/im-a-windows-person-how-can-i-contribute-to-python-part-i/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 13:24:00 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2010/08/16/im-a-windows-person-how-can-i-contribute-to-python-part-i/</guid>
		<description><![CDATA[If I might essay a generalisation: Windows-based users of Python are less likely to have become involved in the development of Python itself. This might be for the same reasons that other people don’t get involved: a lack of time, of inclination, or of confidence in their ability to help. But it might be because [...]]]></description>
			<content:encoded><![CDATA[<p>If I might essay a generalisation: Windows-based users of Python are less likely to have become involved in the development of Python itself. This might be for the same reasons that other people don’t get involved: a lack of time, of inclination, or of confidence in their ability to help. But it might be because Windows users on the whole aren’t so accustomed to delving into the source code of the things they use, nor are they used to checking out from source control, testing fixes and rebuilding. It’s not so much part of the culture.</p>
<p>I’m keen to see more Windows users &amp; developers active in core CPython development. Python has been supported on Windows for a long time by the core development team but it can sometimes feel a little bit like a poor cousin. The majority of Python users (and of key Python developers) are Unix-based: traditionally Linux &amp; BSD, these days often OS X. Even if they’re not unsympathetic to the needs of Windows users, they may not be be in a position to help. But Python is a volunteer effort and if Windows-savvy developers aren’t available, Windows issues will remain unfixed and untested and better support for Windows-specific issues will not be forthcoming.</p>
<p>There are practicalities involved: Subversion or Mercurial, Visual Studio, being able to build Python from scratch and so on, but let’s start from the other end: you’re well-intentioned and motivated, but what should you do? I’m focusing on Windows-specific issues, but some of what I say here applies to anyone who’s interested in helping Python’s core development.</p>
<h2>How should I start?</h2>
<p>You don’t have to be an über-hacker or even a developer at all to contribute to Python. (Although you can do more if you are). You can start by submitting bug reports or requests for improvements to the issue tracker:</p>
<ul>
<li><strong>Good</strong>: Submit a bug report: send an email to bugs@python.org detailing what version of Python you’re using and on which version of Windows, what you did and what went wrong. Or what you think should happen. If you&#8217;re able to re-test with a newer version of Python that will help, in case the bug&#8217;s already been identified and fixed. If it’s a documentation issue you’re describing, be clear what alternative or additional text you’re proposing.
<li><strong>Better</strong>: Submit a bug report or feature request and a failing test case: send an email as above, but attach the simplest possible self-contained script which will cause the failure you’re describing or which will illustrate what should happen.
<li><strong>Best</strong>: Submit a bug report with a failing test and add a patch which you believe will solve the issue plus a patch to the relevant Python test module plus a doc patch if applicable. If this is a documentation issue, the ideal is a patch against the reStructuredText docs; at the least, a clear plain text version of what you’re proposing.
</ul>
<p>Things to bear in mind:</p>
<ul>
<li>Don’t be disappointed if no-one takes any action. Ideally – and often – someone quickly notices the new issue, does a little categorisation on it and assigns it to a developer who’s known to be the owner of the area where the problem occurred. At the least, one or more developers may be added to the nosy list, and one of them may take ownership. Even if that doesn’t happen, you’ve definitely done the right thing by reporting the issue and offering a patch. If it’s Windows-related, feel free to add me to the nosy list. But even if a developer is assigned, developers are volunteers with their own availability, pressures and interests.
<li>Don’t be surprised if the issue isn’t quite as straightforward as it appears at first blush, particularly if backwards compatibility is at stake. There may be some history of which you’re unaware, or some ramifications in other areas of the codebase which aren&#8217;t obvious.
<li>Don’t give up in despair if the issue is rejected. This isn’t a hard-hearted manoeuvre by the core developers to reject all outside help. It just means that things aren’t always as simple as they might appear and some bigger-picture issue might have put the kibosh on your bright idea. If you feel that a valid point has genuinely been misunderstood you’re free to ask that the issue be reopened; but please don’t do this frivolously.
<li>Not all versions of Python are under active development. At the time of writing, the 2.x series is at the end of its life with 2.7 the final release. Clear bugs may be fixed in that branch, but little else. It’s unlikely that anything categorised as a new feature will make it in there. The same goes for 3.1. The latest development branch is version 3.2 where new features will be targetted. Any earlier releases will either see no changes whatsoever or only critical security fixes.
</ul>
<h2>I’m a Windows developer, but where are the problems?</h2>
<p>Being a core Python developer on Windows can mean several things: doing any kind of Python core development when Windows is your primary platform; working on Windows-specific modules, such as msvcrt or winreg, or the Windows-specific aspects of other modules, such as os and subprocess; or assessing and maintaining platform-specific subtleties such as compiler-sensitive datatype sizes or line-ending issues.</p>
<p>A lot depends on your own inclinations, motivations and areas of expertise. If you’re an experienced Visual Studio user you might focus more on some of the compiler-specific issues or build file configurations. If you have experience of sysadmin-type work you might want to look at the os module which wraps some of the Win32 API in posix-like calls or the winreg module which exposes the registry functions. If you’re a general purpose C coder who just uses Windows as a platform then you could look at the core Python code or the parts of the stdlib written in C. If you&#8217;re an MSI guru, look at some of the outstanding issues in Python&#8217;s own MSI and the bdist_msi distutils subsystem.</p>
<p>Ultimately involvement probably comes from one of three things:</p>
<ul>
<li><strong>Scratching your own itch</strong>: is there something in the docs which you’ve never really understood because it relies on knowledge of Unix-specifics? Or just because it’s confusing? Have you been tripped up by a stdlib function which assumes that Windows paths always act like Unix paths? Have you tried to use os.access only to discover that it’s essentially useless on Windows? Do you think you could reimplement the signal module using the Win32 API? Or sponsor the merge of a 3rd-party Windows port of the curses module?
<li><strong>Scratching someone else’s itch</strong>: have a look at <a href="http://bugs.python.org">bugs.python.org</a> and choose an issue which is unresolved. The issue tracker has recently had new quick-searches added to it down the left and you can easily build your own searches. <a href="http://bugs.python.org/issue?@columns=title,id,activity,status&#038;@sort=activity&#038;@group=priority&#038;@filter=components,status&#038;@pagesize=50&#038;@startwith=0&#038;status=1&#038;components=15&#038;@dispname=Windows">This search</a>, for example, looks for unclosed issues which include Windows in the component list. It can be a useful exercise if you simply confirm that an unclear issue still obtains on current versions of Python and, possibly, on recent versions of Windows. Or if you produce a failing test case for a merely textual or vague report. (Something which can take quite some time). But be wary of producing “me-too” noise as people following that particular issue will receive notification emails which don’t add usefully to the known state of affairs.
<li><strong>Finding an itch to scratch</strong>: if you’re keen to contribute but haven’t experienced any problems which need fixing, and haven’t found any existing bugs which take your fancy, then why not just browse <a href="http://svn.python.org/">the source code</a> seeing how things are done and looking for ways to improve. Be careful here since cosmetic, trivial or frivolous changes are generally frowned upon. But, for example, the subprocess and multiprocessing modules both involve some reasonably serious Windows-specific plumbing. The <a href="http://svn.python.org/view/python/branches/py3k/Misc/maintainers.rst?view=markup">module maintainers</a> aren’t necessarily Windows experts and even if they are, the more eyes the better. There are other modules which have Windows-specific elements if only in small ways.
</ul>
<h2>Where should I be helping?</h2>
<ul>
<li><strong>The issue tracker</strong>: <a href="http://bugs.python.org">bugs.python.org</a> hosts the Python issue tracker, an instance of <a href="http://pypi.python.org/pypi/roundup">roundup</a> which keeps track of all bug reports and feature requests. It’s broadly followed by core developers, but a small team keeps track of incoming bugs and tries to categorise them appropriately and to assign them to a known developer if possible, or to add to the issue’s nosy list developers known to be interested in that area of the system. By helping out in this way, you get a fairly good idea of the issues being reported and the work being done on them. And on which core developers have expertise in which areas of the system. It’s also relatively easy to get higher privileges on the tracker than he default logged-in user has so that you can help classify and manage open issues.
<li><strong>Documentation</strong>: The documentation is maintained as <a href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> files <a href="http://svn.python.org/view/python/branches/py3k/Doc/">within Python’s version control repository</a> and is published using <a href="http://docutils.sourceforge.net/rst.html">Sphinx</a>. It’s very easy to change and patch and there’s a <a href="http://svn.python.org/view/python/branches/py3k/Doc/make.bat?view=log">batch</a> file to rebuild it on Windows although you may need to tweak it a little. Doc patches are welcome, whether for small fry such as typos or slight clarifications, or for weightier rewrite.
<li><strong>stdlib Python</strong>: The Python-only parts of the standard library. A lot of the stdlib is written in Python itself; that’s what makes the whole package so portable. Even if you’re not a C developer, you can still debug and test issues in the stdlib itself. It’s especially possible to do this without a C compiler or even a Subversion checkout: you only need to put an altered version of the module in a test directory from which you run the Python interpreter and the interpreter will see the local version first.
<li><strong>stdlib Python &amp; C</strong>: Some of the standard library relies partly or wholly on extension modules, written in C against Python’s C-API. The C is reasonably readable and is often concerned only with moving Python objects to and from some system library, which makes it a fairly restricted subset of C. To do anything useful with this, you will need a C compiler and, ideally, a version-controlled checkout.
<li><strong>Core Python</strong>: The core of CPython is written in C: the objects, the interpreter, the underlying data structures, key built-in modules. You’ll need to be a fairly good C programmer to work here, not least because the impact is high if a mistake is made.
<li><strong>Infrastructure</strong>: CPython needs a certain amount of scaffolding to build, especially on Windows where the standard autoconf/make tools don&#8217;t apply. This scaffolding tends to be under-supported, not least because it’s not very public-facing and doesn’t solve most people’s problems. But it still needs to be done. This includes Visual Studio solution and proj files, msi build mechanisms, buildbot scripts and documentation make files.
</ul>
<p>This is Part I; Part II should include information about checkout out the source, building it, creating &amp; applying patches and working within the development community.</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2010/08/16/im-a-windows-person-how-can-i-contribute-to-python-part-i/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Wanted: Win32-savvy developers for core Python</title>
		<link>http://ramblings.timgolden.me.uk/2010/08/05/wanted-win32-savvy-developers-for-core-python/</link>
		<comments>http://ramblings.timgolden.me.uk/2010/08/05/wanted-win32-savvy-developers-for-core-python/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 09:44:54 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2010/08/05/wanted-win32-savvy-developers-for-core-python/</guid>
		<description><![CDATA[A python-dev post from Steve Holden gave rise to a wider discussion about the effectiveness of the buildbot system. But also to the question of having more people involved in core Python development who are knowledgeable about the Windows aspects of the core and the stdlib.
To get involved you certainly don&#8217;t need to be a [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://mail.python.org/pipermail/python-dev/2010-August/102788.html">python-dev post</a> from <a href="http://www.blogger.com/profile/15732819755000554717">Steve Holden</a> gave rise to a wider discussion about the effectiveness of the buildbot system. But also to the question of having more people involved in core Python development who are knowledgeable about the Windows aspects of the core and the stdlib.</p>
<p>To get involved you certainly don&#8217;t need to be a Windows guru, nor a Python guru. You don&#8217;t need to have oodles of time on your hands. (Although all of the above would help). You do need a willingness to chase down occasionally obscure failing code paths and propose and implement patches. Or workarounds. Or documentation improvements. At present there is a very small number of us watching and fixing win32 issues and, speaking for myself, I have very little time available to help. The more people there are, each of which may have very little time, the more time is available overall to help Python develop and improve.</p>
<p>If you&#8217;d like to get involved but haven&#8217;t bothered previously, please bother now. </p>
<p>If you&#8217;d like to get involved but aren&#8217;t sure what to do, ping me or drop into <a href="http://webchat.freenode.net/?channels=python-dev">#python-dev on IRC</a> or just go to the Python bug tracker and look for <a href="http://bugs.python.org/issue?%40search_text=&#038;ignore=file%3Acontent&#038;title=&#038;%40columns=title&#038;id=&#038;%40columns=id&#038;stage=&#038;creation=&#038;creator=&#038;activity=&#038;%40columns=activity&#038;%40sort=activity&#038;actor=&#038;nosy=&#038;type=&#038;components=15&#038;versions=&#038;dependencies=&#038;assignee=&#038;keywords=&#038;priority=&#038;%40group=priority&#038;status=1&#038;%40columns=status&#038;resolution=&#038;nosy_count=&#038;message_count=&#038;%40pagesize=50&#038;%40startwith=0&#038;%40queryname=&#038;%40old-queryname=&#038;%40action=search">Windows-related problems</a>. (That search isn&#8217;t exhaustive as it relies on someone setting the Component field, but it certainly brings some results back).</p>
<p>Guido&#8217;s <a href="http://mail.python.org/pipermail/python-dev/2010-July/102306.html">recently expressed a wish</a> to give more people commit privileges, and MSDN have in the past generously provided free licences to allow core developers to develop and test on different Windows and Visual Studio versions.</p>
<p>There&#8217;s <a href="http://www.python.org/dev/">documentation on python.org</a> for developers, and a new <a href="http://docs.pythonsprints.com/core_development/beginners.html">in-progress document</a> by Brian Curtin on the Python sprints site.</p>
<p>Even if your contribution is to confirm that a bug still applies, or has been fixed, or to add tests to an undertested module which you use yourself, or to clarify or add some documentation, it will still be a very useful addition.</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2010/08/05/wanted-win32-savvy-developers-for-core-python/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Upgrading to Python3: minor things which caught me out</title>
		<link>http://ramblings.timgolden.me.uk/2010/07/05/upgrading-to-python3-minor-things-which-caught-me-out/</link>
		<comments>http://ramblings.timgolden.me.uk/2010/07/05/upgrading-to-python3-minor-things-which-caught-me-out/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 14:15:43 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2010/07/05/upgrading-to-python3-minor-things-which-caught-me-out/</guid>
		<description><![CDATA[I&#8217;ve already made one module Python3-compatible. I decided to bite the bullet and make my not-really-released winsys module completely Python3. I&#8217;d tried the 2to3.py approach but it left just enough false positives &#038; negatives (sorry, don&#8217;t remember the details) that I decided to go by hand, including translating the unit tests from nose format to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve already made <a href="http://timgolden.me.uk/python/wmi/index.html">one module</a> Python3-compatible. I decided to bite the bullet and make my not-really-released <a href="http://timgolden.me.uk/python/winsys/index.html">winsys</a> module completely Python3. I&#8217;d tried the 2to3.py approach but it left just enough false positives &#038; negatives (sorry, don&#8217;t remember the details) that I decided to go by hand, including translating the unit tests from nose format to the updated unittest format.</p>
<p>Although I was reasonably clued-in on the changes from 2 to 3, I was caught out by a few things, which I list here in case they help anyone else:</p>
<ul>
<li><strong>__nonzero__ is now __bool__</strong>: I knew this perfectly well, but it took me a while to find out why my tests were failing. 2to3 would have picked this up straightaway.</li>
<li><strong>__hash__ isn&#8217;t inherited if __eq__ is defined</strong>: this one surprised me and took a bit of research. (All right; I actually <a href="http://docs.python.org/dev/py3k/reference/datamodel.html?highlight=__hash__#object.__hash__">read the docs</a> for __hash__).</li>
<li><strong>bytes vs str</strong>: well, obviously you knew this, but it&#8217;s bitten me in some slightly unexpected places when interfacing via pywin32. The error message speaks of expecting a buffer object, which threw me slightly.</li>
<li><strong><strike>assertTrue doesn&#8217;t bool its param</strike></strong>: UPDATE - of course this isn&#8217;t true at all; I was confusing this and the __bool__/__nonzero__ issue above. Thanks to Marius Gedminas for pointing this out.</li>
<li><strong>pywin32 generates tz-aware datetime objects</strong>: for a long time, pywin32 rolled its own datetime type (as Python had none). Last year, Mark H canvassed the python-win32 list about committing to the Python datetime type. And now it&#8217;s there. But it&#8217;s tz-aware. And the core Python type isn&#8217;t. Fortunately, pywin32 has for a while shipped with the win32timezone module which solves the issue.</li>
</ul>
<p>I&#8217;m sure there&#8217;ll be more which I&#8217;ll add here as they come along.</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2010/07/05/upgrading-to-python3-minor-things-which-caught-me-out/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Python 2.7 is out. The end of the road approaches.</title>
		<link>http://ramblings.timgolden.me.uk/2010/07/05/python-27-is-out-the-end-of-the-road-approaches/</link>
		<comments>http://ramblings.timgolden.me.uk/2010/07/05/python-27-is-out-the-end-of-the-road-approaches/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 08:33:38 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2010/07/05/python-27-is-out-the-end-of-the-road-approaches/</guid>
		<description><![CDATA[Congratulations to Benjamin Peterson and everyone else who&#8217;s contributed to the release of Python 2.7. I&#8217;m already trying to push myself over to 3.x for everyday use and I&#8217;m confident that this psychological milestone will give other library developers the motivation to start looking at the 3.x series for their live code and newer releases.
Irmen [...]]]></description>
			<content:encoded><![CDATA[<p>Congratulations to Benjamin Peterson and <a href="http://mail.python.org/pipermail/python-dev/2010-July/101440.html">everyone else who&#8217;s contributed</a> to the release of Python 2.7. I&#8217;m already trying to push myself over to 3.x for everyday use and I&#8217;m confident that this psychological milestone will give other library developers the motivation to start looking at the 3.x series for their live code and newer releases.</p>
<p>Irmen de Jong has released a <a href="http://www.xs4all.nl/~irmen/pyro4/download/Pyro-4.1-python3.tar.gz">Python3-compatible version</a> of the newly-rewritten <a href="http://www.razorvine.net/python/Pyro">Pyro4</a> (as well as maintaining for 2.x). The developers of <a href="http://github.com/mkleehammer/pyodbc">pyodbc</a> (a module I use extensively) have a Python3 branch which is due to be merged soon. <a href="http://sourceforge.net/projects/pywin32/">pywin32</a> has been 3.x for quite a while now (thanks, Mark &#038; Roger). Once I finish porting my own win32-specific stuff, I&#8217;ll be well-placed to see 3.x rolled out here at work.</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2010/07/05/python-27-is-out-the-end-of-the-road-approaches/feed/</wfw:commentRss>
		</item>
		<item>
		<title>I don&#8217;t really do reddit</title>
		<link>http://ramblings.timgolden.me.uk/2010/07/05/i-dont-really-do-reddit/</link>
		<comments>http://ramblings.timgolden.me.uk/2010/07/05/i-dont-really-do-reddit/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 08:21:26 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Tech]]></category>

		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2010/07/05/i-dont-really-do-reddit/</guid>
		<description><![CDATA[Following an interesting-looking link from someone&#8217;s blog / tweet / don&#8217;t remember led me to the Python section on reddit. Where I was surprised to find a link to my recent print/print() post with some comments. Now, apart from the occasional glance I don&#8217;t follow reddit. It looks like an interesting place, but frankly my [...]]]></description>
			<content:encoded><![CDATA[<p>Following an interesting-looking link from someone&#8217;s blog / tweet / don&#8217;t remember led me to the <a href="http://www.reddit.com/r/Python/">Python section on reddit</a>. Where I was surprised to find a link to my recent <a href="http://ramblings.timgolden.me.uk/2010/07/02/python-3-print-or-print/">print/print()</a> post with some comments. Now, apart from the occasional glance I don&#8217;t follow reddit. It looks like an interesting place, but frankly my time is already over-committed and I just <i>know</i> I&#8217;ll get drawn into discussing something or helping someone out. So I stay away.</p>
<p>The only drawback to this approach is that people are commenting on a post I made (and which someone else submitted to reddit) without my being aware that the discussing is taking place, and without my being able to engage in that discussion. Which is a shame. But probably for the best :)</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2010/07/05/i-dont-really-do-reddit/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Python 3: print or print()</title>
		<link>http://ramblings.timgolden.me.uk/2010/07/02/python-3-print-or-print/</link>
		<comments>http://ramblings.timgolden.me.uk/2010/07/02/python-3-print-or-print/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 08:45:59 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Rants]]></category>

		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2010/07/02/python-3-print-or-print/</guid>
		<description><![CDATA[There&#8217;s a thread over on the Python list which started a week ago as I write and is still running. The OP titled his post the provocative  &#8220;I strongly dislike Python 3&#8243; but what it really comes down to is &#8220;I strongly dislike print()&#8221;. Various people have come in on both sides of this [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a <a href="http://mail.python.org/pipermail/python-list/2010-June/1248174.html">thread</a> over on the Python list which started a week ago as I write and is still running. The OP titled his post the provocative  &#8220;I strongly dislike Python 3&#8243; but what it really comes down to is &#8220;I strongly dislike print()&#8221;. Various people have come in on both sides of this well-worn argument.</p>
<p>Now, I don&#8217;t really mind futile discussions, and this clearly is one: Python 3 isn&#8217;t going to switch back, no matter how many people weigh in on the print-as-statement side. I&#8217;m in that camp myself, and when the matter was first up for discussion I had a to-and-fro with Alex Martelli on the subject which I backed away from fairly quickly. I continue to enjoy and benefit from Python regardless; I contribute to its development very slightly and very rarely; and even were I the most prolific contributor on the planet, I don&#8217;t believe that would give me any particular right to dictate design decisions of this sort. You take the rough with the smooth.</p>
<p>I think the side of the discussion which irks me the most is from those who are defending the print-as-function decision. Clearly there are cogent and persuasive reasons why print should be / should have been a function. No-one&#8217;s pretending that this was a decision taken randomly and for the sake of change. Or even for the sake of a foolish consistency. But if someone&#8217;s working practice involves using print a lot &#8212; perhaps in the interpreter rather than in a code editor &#8212; then the switch to the function version is clearly a burden. It may be more or less of a burden, but it involves having to do something which you didn&#8217;t have to do before. Being told that you should have been using logging or pdb or sys.stdout.write &#8212; all of which are valid tools to use in the proper place &#8212; doesn&#8217;t really make your life any easier.</p>
<p>So while Python 3 is now the default interpreter on my shortcut keys and I&#8217;m trying to write new code against 3.2, I <em>still</em> find it a pain to overcome the very long habit of, eg, <code>print ad.find_user ().sAMAccountName</code>. Obviously if Python 1.5.2 had had print () as a function originally, I wouldn&#8217;t find is so hard now. ;)</p>
<p>(As an aside I did wonder at first whether the American or some other non-UK keyboards had the brackets in some more convenient spot, but it doesn&#8217;t appear so&#8230;)</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2010/07/02/python-3-print-or-print/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dojo Attack!</title>
		<link>http://ramblings.timgolden.me.uk/2010/07/02/dojo-attack/</link>
		<comments>http://ramblings.timgolden.me.uk/2010/07/02/dojo-attack/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 08:25:59 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2010/07/02/dojo-attack/</guid>
		<description><![CDATA[We had a blast at the London Python Dojo last night. Food, drink, and location generously provided as ever by Fry-IT (may all their contracts come in on time and under budget!) and a book for the raffle from O&#8217;Reilly (may all their titles remain in demand). While the wining and dining (or was that [...]]]></description>
			<content:encoded><![CDATA[<p>We had a blast at the London Python Dojo last night. Food, drink, and location generously provided as ever by <a href="http://www.fry-it.com/">Fry-IT</a> (may all their contracts come in on time and under budget!) and <a href="http://oreilly.com/catalog/9780596809492">a book</a> for the raffle from O&#8217;Reilly (may all their titles remain in demand). While the wining and dining (or was that whining and dinning?) was in progress, <a href="http://twitter.com/ntoll">Nicholas</a> had set up a whiteboard for what-to-do suggestions. When it came to vote, some ideas were thought good but impractical for one evening, and the winner was the original suggestion: <a href="http://github.com/phreeza/cells">Cells</a>.</p>
<p>Well I had misgivings as to whether we could grasp the codebase and get a workable solution in place within an hour and a bit, but it was great. The idea is &#8212; within the rules of the game &#8212; to pit your agents against the other teams&#8217;, trying for a winning strategy combining eating, attacking, moving, and replicating, each of which need, lose or gain energy according to certain rules. The agents can also message others on the same team to communicate, eg, the location of food or enemies. We had four teams, some with agents based on the sample code, others with from-scratch algorithms.</p>
<p>The clear winners were the &#8220;white&#8221; agents &#8212; Team 2 &#8212; who&#8217;d based their strategy on one of the supplied examples plus an expansion phase which kicked in only once a certain amount of time had passed and involved replicating like mad. On Team 1, we&#8217;d gone for a pacifist approach, with some of our agents as &#8220;Buddhas&#8221;, staying still and eating, the rest &#8220;Hungry Ghosts&#8221;, eating, moving and replicating. None of them attacked. FWIW, we got wiped out pretty quickly, although that did depend on how far you started from the voracious white team.</p>
<p>The other teams had differing strategies: explorers and eaters; or tribal warfare &#8212; which looked hilarious on-screen, as all the yellows suddenly went into warfare mode, sending each other the location of nearby enemies and flocking towards them.</p>
<p>Next Dojo&#8217;s in September, but <a href="http://www.europython.eu/">EuroPython</a>&#8217;s later this month and I&#8217;m sure there&#8217;ll be quite a few us there.</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2010/07/02/dojo-attack/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Return datetime object from C extension</title>
		<link>http://ramblings.timgolden.me.uk/2010/06/18/return-datetime-object-from-c-extension/</link>
		<comments>http://ramblings.timgolden.me.uk/2010/06/18/return-datetime-object-from-c-extension/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 08:27:54 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2010/06/18/return-datetime-object-from-c-extension/</guid>
		<description><![CDATA[Combination of aide-memoire and Python info. If you want to return a datetime object from within a C extension, you need to invoke the PyDateTime_IMPORT macro and you need to do it without brackets and you need to do it from within your module&#8217;s import function:

PyMODINIT_FUNC
PyInit_fileutils (void)
{
  PyDateTime_IMPORT;
  return PyModule_Create (&#038;fileutils_module);
}

This is &#8212; [...]]]></description>
			<content:encoded><![CDATA[<p>Combination of aide-memoire and Python info. If you want to return a datetime object from within a C extension, you need to invoke the PyDateTime_IMPORT macro and you need to do it without brackets and you need to do it from within your module&#8217;s import function:</p>
<pre>
PyMODINIT_FUNC
PyInit_fileutils (void)
{
  PyDateTime_IMPORT;
  return PyModule_Create (&#038;fileutils_module);
}
</pre>
<p>This is &#8212; sort of &#8212; expressed <a href="http://docs.python.org/py3k/c-api/datetime.html">in the current docs</a> but because the markup uses the :cfunction: role, Sphinx automatically appends a pair of brackets to the text. Additionally there&#8217;s no indication of where to invoke the macro. I tried a couple of places (at the head of the file, somewhere in the code) before discovering that the code would at least compile without it, so I assumed that it wasn&#8217;t needed for my simple use of PyDateTime_FromDateAndTime. Until it crashed on me, at which point <a href="http://www.google.co.uk/#hl=en&#038;source=hp&#038;q=site%3Amail.python.org++PyDateTime_FromDateAndTime&#038;btnG=Google+Search&#038;aq=f&#038;aqi=&#038;aql=&#038;oq=site%3Amail.python.org++PyDateTime_FromDateAndTime&#038;gs_rfai=&#038;fp=874a35a4586378b8">I went searching</a> and <a href="http://mail.python.org/pipermail/python-list/2009-November/1227945.html">found the answer</a> (thanks, Martin).</p>
<p>I plan to patch the docs, at least to change the markup to use cmacro, possibly to indicate usage once I&#8217;ve got some input from more knowledgeable people.</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2010/06/18/return-datetime-object-from-c-extension/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Do the Dojo</title>
		<link>http://ramblings.timgolden.me.uk/2010/06/04/do-the-dojo/</link>
		<comments>http://ramblings.timgolden.me.uk/2010/06/04/do-the-dojo/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 08:55:50 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2010/06/04/do-the-dojo/</guid>
		<description><![CDATA[Much fun and laughter at the Dojo last night (helped along, as always, by Fry-IT&#8217;s generous sponsorship of location, beer &#038; pizza). Despite the name, this month&#8217;s was more of a talks session, picking up threads from previous Dojos and a couple of other random things. Went on a bit long as a result, but [...]]]></description>
			<content:encoded><![CDATA[<p>Much fun and laughter at the Dojo last night (helped along, as always, by <a href="http://www.fry-it.com/">Fry-IT</a>&#8217;s generous sponsorship of location, beer &#038; pizza). Despite the name, this month&#8217;s was more of a talks session, picking up threads from previous Dojos and a couple of other random things. Went on a bit long as a result, but good fun nonetheless.</p>
<p>I kicked off with a talk about <a href="http://www.xs4all.nl/~irmen/pyro3/">Pyro</a>, which has recently announced a <a href="http://www.razorvine.net/python/Pyro">major version alpha release</a> with versions for Python 2.x and 3.x. We&#8217;d discussed the possibility of enhancing our desultory Adventure Game efforts with multiplayerness and I&#8217;d volunteered to show how Pyro might be used for the purpose. Of course, the last-minute neatening-up and bugfixes I&#8217;d made before leaving the office didn&#8217;t make it onto my laptop, leaving me scrambling to correct code with minutes to spare. (Let this be a lesson to you: hg commit &#038;&#038; hg push). Although I&#8217;d prepared a fairly tight series of examples and didn&#8217;t hang around, I still ran for 40 minutes with a few questions thrown in. (Coincidentally, as I sat down again, I had an email from Irmen de Jong, the author of Pyro, asking if I&#8217;d tried the new Pyro 4.x on Python 3.x yet. As it happens, I&#8217;d intended to do a simple comparison as part of my presentation, but I ran out of time).</p>
<p>Dave Kirby followed from the same angle, with a presentation about Twisted. *His* talk was hampered by laptop-to-projector issues which gave us a green screen, then a red screen, then as we were preparing for a blue screen it went green-red before Gaultier kicked the projector and we went back to white. I certainly came out understanding more about Twisted (which isn&#8217;t saying much, admittedly) and I can see why people enthuse about it so much. I&#8217;m also aware, from comments on the main Python mailing lists, that the Twisted guys have done a lot of work to file away the rough edges which result from getting low-level cross-platform networking code running.</p>
<p>I think Tom Dunham&#8217;s presentation was the best of the night (altho&#8217; I&#8217;d had a glass of wine by then, which probably helped). A few dojos ago, one team had used <a href="http://divmod.org/trac/wiki/DivmodReverend">Divmod&#8217;s Reverend</a> implementation of a Bayesian classifier as a way to have more flexible parsing / analysis of the user input. It had worked at first, but had soon fallen apart in spite of some ingenious (read: desperate) attempts to &#8220;trick&#8221; the classifier into giving the desired result. Tom had gone away to investigate how we&#8217;d misunderstood the way in which such a classifier works. He came back with a presentation which skipped the maths (fortunately for most of us, I suspect!) and focused on the internals of the classifier, showing how our approach was hopelessly overloading the classification pools to the point where it would classify &#8220;the moon is cheese&#8221; and &#8220;the&#8221; in exactly the same way.</p>
<p>Jon Ribbens followed with a demo of his &#8212; now quite mature &#8212; <a href="http://jonpy.sourceforge.net/">jon.py web framework</a>, built before almost all the other ones in common use today but still offering remarkable value for (no) money.</p>
<p>In spite of the late hour (gone 10pm before he started) Nicholas Tollervey, our brave organiser, gave a Lightning talk on <a href="http://www.fluidinfo.com/">FluidBD</a>, which answered at least some of the questions we had about it (such as: what is it?), although it left me with the impression that it could be a Brave New World or a Interesting Curiosity.</p>
<p>Next time we&#8217;ll probably go back into Dojo mode proper, and with a new project to replace our slightly tired Adventure Game.</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2010/06/04/do-the-dojo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CoApp</title>
		<link>http://ramblings.timgolden.me.uk/2010/05/13/coapp/</link>
		<comments>http://ramblings.timgolden.me.uk/2010/05/13/coapp/#comments</comments>
		<pubDate>Thu, 13 May 2010 12:49:27 +0000</pubDate>
		<dc:creator>tim</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://ramblings.timgolden.me.uk/2010/05/13/coapp/</guid>
		<description><![CDATA[Trent Nelson has just posted to python-dev about a Microsoft-sponsored proposal called CoApp. The idea is &#8212; as I understand it &#8212; to support the packaging of Open Source s/w on the Windows platform. The current situation is quite well outlined on the wiki. It looks like a very interesting initiative and I for one [...]]]></description>
			<content:encoded><![CDATA[<p>Trent Nelson has <a href="http://mail.python.org/pipermail/python-dev/2010-May/100056.html">just posted to python-dev</a> about a Microsoft-sponsored proposal called <a href="http://coapp.org/">CoApp</a>. The idea is &#8212; as I understand it &#8212; to support the packaging of Open Source s/w on the Windows platform. The current situation is quite well outlined <a href="http://coapp.org/About_CoApp/What_is_CoApp%3f">on the wiki</a>. It looks like a very interesting initiative and I for one hope that it succeeds.</p>
<p>I find exactly the issues that the author outlines on page: open source s/w is mostly *nix-oriented, naturally, and assumes the development setups which that implies. By and large, Windows ports are either best-endeavour bolt-ons or rely on Cygwin / MingW environments. Python performs rather better here with a maintained VS solution, but even there you have to do a little bit more jiggery-pokery with file locations than I&#8217;d like.</p>
<p>I&#8217;ve signed up for the CoApp announcments list, so let&#8217;s see what happens&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://ramblings.timgolden.me.uk/2010/05/13/coapp/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
