<?xml version="1.0" encoding="UTF-8"?>
<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/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>David Janes&#039; Code Weblog &#187; python</title>
	<atom:link href="http://code.davidjanes.com/blog/category/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://code.davidjanes.com/blog</link>
	<description></description>
	<lastBuildDate>Fri, 03 Feb 2012 00:49:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>times</title>
		<link>http://code.davidjanes.com/blog/2012/02/02/times/</link>
		<comments>http://code.davidjanes.com/blog/2012/02/02/times/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 00:49:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://code.davidjanes.com/blog/?p=821</guid>
		<description><![CDATA[Interesting Times is a small, minimalistic, Python library for dealing with time conversions to and from timezones, for once and for all. &#8230; times tries to make working with times and timezones a little less of a clusterfuck and hopefully set a standard of some sort. See my previous posts on working with pytz and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://github.com/nvie/times#readme">Interesting</a></p>
<blockquote><p>
Times is a small, minimalistic, Python library for dealing with time conversions to and from timezones, for once and for all.<br />
&#8230;<br />
times tries to make working with times and timezones a little less of a clusterfuck and hopefully set a standard of some sort.
</p></blockquote>
<p>See my previous posts on working with <a href="http://code.davidjanes.com/blog/2008/12/22/working-with-dates-times-and-timezones-in-python/">pytz and dateutil</a> (and <a href="http://code.davidjanes.com/blog/2008/12/22/pytz-utcoffset/">also</a>). I&#8217;m looking forward to trying out times.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.davidjanes.com/blog/2012/02/02/times/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thoughts on Python 3</title>
		<link>http://code.davidjanes.com/blog/2011/12/07/thoughts-on-python-3/</link>
		<comments>http://code.davidjanes.com/blog/2011/12/07/thoughts-on-python-3/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 12:36:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://code.davidjanes.com/blog/?p=817</guid>
		<description><![CDATA[I&#8217;m learning a new language next year (suggestions welcome). I&#8217;ve totally ignored Python 3 and plan to continue doing so. Read Armin Ronacher on &#8220;Thoughts on Python 3&#8220;. Because as it stands, Python 3 is the XHTML of the programming language world. It&#8217;s incompatible to what it tries to replace but does not offer much [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m learning a new language next year (suggestions welcome). I&#8217;ve totally ignored Python 3 and plan to continue doing so. </p>
<p>Read Armin Ronacher on &#8220;<a href="http://lucumr.pocoo.org/2011/12/7/thoughts-on-python3/">Thoughts on Python 3</a>&#8220;.</p>
<blockquote><p>Because as it stands, Python 3 is the XHTML of the programming language world. It&#8217;s incompatible to what it tries to replace but does not offer much besides being more “correct”.</p></blockquote>
<p>Python 3 kills <a href="http://xkcd.com/353/">what makes Python great</a>.  </p>
]]></content:encoded>
			<wfw:commentRss>http://code.davidjanes.com/blog/2011/12/07/thoughts-on-python-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python, Sqlite3, FTS3 &amp; MacOSX</title>
		<link>http://code.davidjanes.com/blog/2011/11/15/python-sqlite3-fts3-macosx/</link>
		<comments>http://code.davidjanes.com/blog/2011/11/15/python-sqlite3-fts3-macosx/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 13:49:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[db]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://code.davidjanes.com/blog/?p=815</guid>
		<description><![CDATA[If you can&#8217;t load FTS3 on a Mac, this post on StackOverflow tells you how to solve the problem. The final bit of magic is in: from pysqlite2 import dbapi2 as sqlite3]]></description>
			<content:encoded><![CDATA[<p>If you can&#8217;t load FTS3 on a Mac, <a href="http://stackoverflow.com/questions/1545479/force-python-to-forego-native-sqlite3-and-use-the-installed-latest-sqlite3-ver">this post on StackOverflow tells you how to solve the problem</a>.</p>
<p>The final bit of magic is in:</p>
<pre>
from pysqlite2 import dbapi2 as sqlite3
</pre>
]]></content:encoded>
			<wfw:commentRss>http://code.davidjanes.com/blog/2011/11/15/python-sqlite3-fts3-macosx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding alpha levels to images with PIL</title>
		<link>http://code.davidjanes.com/blog/2011/09/18/adding-alpha-levels-to-images-with-pil/</link>
		<comments>http://code.davidjanes.com/blog/2011/09/18/adding-alpha-levels-to-images-with-pil/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 09:54:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code fragments]]></category>
		<category><![CDATA[pil]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://code.davidjanes.com/blog/?p=747</guid>
		<description><![CDATA[I recently was tasked by a client with replacing a number of images &#8212; PNGs with alpha levels, such that parts of the image were transparent &#8212; with new pictures. The issue was how to get the exact same alpha level holes in the new images. Here&#8217;s how I did it. I renamed one of [...]]]></description>
			<content:encoded><![CDATA[<p>I recently was tasked by a client with replacing a number of images &#8212; PNGs with alpha levels, such that parts of the image were transparent &#8212; with new pictures. The issue was how to get the exact same alpha level holes in the new images.</p>
<p>Here&#8217;s how I did it. I renamed one of the original images &#8220;template.png&#8221; and assumed that all the source images will the exactly the same size as the template. I then wrote this Python script using the <a href="http://www.pythonware.com/products/pil/">Python Imaging Library</a>.</p>
<pre>import sys
import os
import re
import Image

#
#   Get the template
#
itemplate = Image.open("template.png")
itemplate.getpixel(( 0, 0 ))
r, g, b, alpha = itemplate.split()

#
#   Get the JPGs - they must be exactly the same size
#
for in_file in os.listdir("."):
    if not in_file.endswith(".jpg"):
        continue

    isrc = Image.open(in_file)
    if isrc.size != itemplate.size:
        continue

    idst = isrc.convert("RGBA")
    idst.putalpha(alpha)

    idst.save(in_file[:-4] + ".png")
</pre>
]]></content:encoded>
			<wfw:commentRss>http://code.davidjanes.com/blog/2011/09/18/adding-alpha-levels-to-images-with-pil/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Foursquare, Python &amp; OAuth2</title>
		<link>http://code.davidjanes.com/blog/2011/02/28/foursquare-python-oauth2/</link>
		<comments>http://code.davidjanes.com/blog/2011/02/28/foursquare-python-oauth2/#comments</comments>
		<pubDate>Mon, 28 Feb 2011 16:21:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[authentication]]></category>
		<category><![CDATA[code fragments]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://code.davidjanes.com/blog/?p=727</guid>
		<description><![CDATA[Foursquare has revved their API, but there&#8217;s no Python Library to support it. Here&#8217;s how to use it from Python Get OAuth info from foursquare &#8212; the callback URL does not matter _but_ you must record here. https://foursquare.com/oauth/register. Fill in the results into CLIENT_ID, CLIENT_SECRET and CALLBACK_URL Run this, enter the URL in browser, get code [...]]]></description>
			<content:encoded><![CDATA[<p>Foursquare has revved their API, <a href="http://developer.foursquare.com/docs/libraries.html">but there&#8217;s no Python Library to support it</a>. Here&#8217;s how to use it from Python</p>
<ol>
<li>Get OAuth info from foursquare &#8212; the callback URL does not matter _but_ you must record here. <a href="https://foursquare.com/oauth/">https://foursquare.com/oauth/register</a>. Fill in the results into <code>CLIENT_ID</code>, <code>CLIENT_SECRET</code> and <code>CALLBACK_URL</code></li>
<li>Run this, enter the URL in browser, get code as <code>FS_ACCESS_CODE</code>, add back here</li>
<li>Run this, fill in <code>FS_ACCESS_TOKEN</code></li>
<li>Run this, you&#8217;re authorized: enjoy!</li>
</ol>
<p>Notes</p>
<ol>
<li>Python OAuth2 from here:  <a href="https://github.com/rodbegbie/python-oauth2">https://github.com/rodbegbie/python-oauth2</a></li>
<li><a href="http://groups.google.com/group/foursquare-api/browse_thread/thread/d18cba375d14fc04">This is entirely standing on the shoulder&#8217;s of Rod Begbie&#8217;s work</a>.</li>
</ol>
<p>Code:</p>
<pre>import oauth2
import json
import pprint

OAUTH_BASE = "https://foursquare.com/oauth2/authenticate"

CLIENT_ID = ""
CLIENT_SECRET = ""
CALLBACK_URL = ""

FS_ACCESS_CODE = ""
FS_ACCESS_TOKEN = ""

client = oauth2.Client2(CLIENT_ID, CLIENT_SECRET, OAUTH_BASE)

if not CLIENT_ID:
  print "=== Register your Foursquare data here"
  print "=== Copy back CLIENT_ID, CLIENT_SECRET and CALLBACK_URL here"
  print "https://foursquare.com/oauth/"
elif FS_ACCESS_TOKEN:
  headers, content = client.request("https://api.foursquare.com/v2/users/self",
   access_token = FS_ACCESS_TOKEN)

  pprint.pprint({
    "headers" : headers,
    "content" : json.loads(content),
  })
elif not FS_ACCESS_CODE:
  print "=== Enter this URL in your browser."
  print "=== Copy the CODE in the URL that results into FS_ACCESS_CODE"
  print client.authorization_url(redirect_uri = CALLBACK_URL, 
    endpoint='authenticate')
else:
  print "=== Here is your Access Token"
  print "=== Copy into FS_ACCESS_TOKEN as start using Foursquare"
  print client.access_token(FS_ACCESS_CODE, redirect_uri= CALLBACK_URL,
    grant_type='authorization_code')["access_token"]</pre>
]]></content:encoded>
			<wfw:commentRss>http://code.davidjanes.com/blog/2011/02/28/foursquare-python-oauth2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python recipe &#8211; sorting strings with numbers in them</title>
		<link>http://code.davidjanes.com/blog/2010/12/24/python-recipe-sorting-strings-with-numbers-in-them/</link>
		<comments>http://code.davidjanes.com/blog/2010/12/24/python-recipe-sorting-strings-with-numbers-in-them/#comments</comments>
		<pubDate>Fri, 24 Dec 2010 14:16:10 +0000</pubDate>
		<dc:creator>David Janes</dc:creator>
				<category><![CDATA[code fragments]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://code.davidjanes.com/blog/?p=706</guid>
		<description><![CDATA[Here&#8217;s a quick Christmas Eve recipe for sorting lists of strings that have numbers in them at some place. import re import string numeric_rex = re.compile('(\d+)') def numeric_sorter(a, b): av = filter(None, numeric_rex.split(a)) bv = filter(None, numeric_rex.split(b)) while av and bv: af = av.pop(0) bf = bv.pop(0) if af[0] in string.digits and bf[0] in string.digits: [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick Christmas Eve recipe for sorting lists of strings that have numbers in them at some place.</p>
<pre>
import re
import string

numeric_rex = re.compile('(\d+)')

def numeric_sorter(a, b):
    av = filter(None, numeric_rex.split(a))
    bv = filter(None, numeric_rex.split(b))

    while av and bv:
        af = av.pop(0)
        bf = bv.pop(0)

        if af[0] in string.digits and bf[0] in string.digits:
            r = cmp(int(af), int(bf))
        else:
            r = cmp(af, bf)

        if r != 0:
            return  r

    if av:
        return  1
    elif bv:
        return  -1
    else:
        return  0
</pre>
<p>Here&#8217;s an example of it being used:</p>
<pre>
>>> items = [ "Item1", "Item10", "Item", "Item9", "Item100", "ItemLogo", ]
>>> items.sort()
>>> pprint.pprint(items)
['Item', 'Item1', 'Item10', 'Item100', 'Item9', 'ItemLogo']
>>> items.sort(numeric_sorter)
>>> pprint.pprint(items)
['Item', 'Item1', 'Item9', 'Item10', 'Item100', 'ItemLogo']
</pre>
]]></content:encoded>
			<wfw:commentRss>http://code.davidjanes.com/blog/2010/12/24/python-recipe-sorting-strings-with-numbers-in-them/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to add XCode &#039;#pragma mark&#039;-like sections for Python code</title>
		<link>http://code.davidjanes.com/blog/2010/01/11/how-to-add-xcode-pragma-mark-like-sections-for-python-code/</link>
		<comments>http://code.davidjanes.com/blog/2010/01/11/how-to-add-xcode-pragma-mark-like-sections-for-python-code/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 12:43:10 +0000</pubDate>
		<dc:creator>David Janes</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://code.davidjanes.com/blog/?p=649</guid>
		<description><![CDATA[Just add in your Python comments: # MARK: comment # TODO: comment # FIXME: comment # !!!: comment # ???: comment From here.]]></description>
			<content:encoded><![CDATA[<p>Just add in your Python comments:</p>
<pre># MARK: <em>comment</em>
# TODO: <em>comment</em>
# FIXME: <em>comment</em>
# !!!: <em>comment</em>
# ???: <em>comment</em></pre>
<p>From <a href="http://mail.python.org/pipermail/pythonmac-sig/2008-August/020375.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.davidjanes.com/blog/2010/01/11/how-to-add-xcode-pragma-mark-like-sections-for-python-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PIL, libjpeg, jpeg and Mac OS/X Snow Leopard</title>
		<link>http://code.davidjanes.com/blog/2009/11/16/pil-libjpeg-jpeg-and-mac-osx-snow-leopard/</link>
		<comments>http://code.davidjanes.com/blog/2009/11/16/pil-libjpeg-jpeg-and-mac-osx-snow-leopard/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 12:47:50 +0000</pubDate>
		<dc:creator>David Janes</dc:creator>
				<category><![CDATA[macintosh]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://code.davidjanes.com/blog/?p=620</guid>
		<description><![CDATA[If you want to the use the Python Imaging Library on Mac OS/X Snow Leopard, these instructions appear to be the best way to to get libjpeg installed: 1. Download the source from http://libjpeg.sourceforge.net/ 2. Extract, configure, make: tar zxvf jpegsrc.v6b.tar.gz cd jpeg-6b cp /usr/share/libtool/config/config.sub . cp /usr/share/libtool/config/config.guess . ./configure --enable-shared --enable-static make 3. You [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to the use the <a href="http://www.pythonware.com/products/pil/">Python Imaging Library</a> on Mac OS/X Snow Leopard, <a href="http://jetfar.com/libjpeg-and-python-imaging-pil-on-snow-leopard/">these instructions</a> appear to be the best way to to get <code>libjpeg</code> installed:</p>
<blockquote><p>1. Download the source from <a href="http://libjpeg.sourceforge.net/">http://libjpeg.sourceforge.net/</a></p>
<p>2. Extract, configure, make:<br />
<code><br />
tar zxvf jpegsrc.v6b.tar.gz<br />
cd jpeg-6b<br />
cp /usr/share/libtool/config/config.sub .<br />
cp /usr/share/libtool/config/config.guess .<br />
./configure --enable-shared --enable-static<br />
make<br />
</code></p>
<p>3. You may need to create the following directories:<br />
<code><br />
sudo mkdir -p /usr/local/include<br />
sudo mkdir -p /usr/local/lib<br />
sudo mkdir -p /usr/local/man/man1<br />
</code></p>
<p>4. Now you can install it as usual.<br />
<code><br />
sudo make install</code></p></blockquote>
<p>I used to use <a href="http://www.finkproject.org/">Fink</a> on Leopard, but it didn&#8217;t seem to work to well this time. If you&#8217;ve previously made an attempt at installing PIL, make sure to <code>rm -rf build</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.davidjanes.com/blog/2009/11/16/pil-libjpeg-jpeg-and-mac-osx-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Django 1.1 and ImageField</title>
		<link>http://code.davidjanes.com/blog/2009/11/16/django-1-1-and-imagefield/</link>
		<comments>http://code.davidjanes.com/blog/2009/11/16/django-1-1-and-imagefield/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 12:42:12 +0000</pubDate>
		<dc:creator>David Janes</dc:creator>
				<category><![CDATA[code fragments]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://code.davidjanes.com/blog/?p=616</guid>
		<description><![CDATA[Having recently upgraded to Django 1.1, I suddenly started getting the error messages that look like: File "/Library/Python/2.6/site-packages/django/db/models/fields/related.py", line 257, in __get__ rel_obj = QuerySet(self.field.rel.to).get(**params) File "/Library/Python/2.6/site-packages/django/db/models/query.py", line 300, in get num = len(clone) File "/Library/Python/2.6/site-packages/django/db/models/query.py", line 81, in __len__ self._result_cache = list(self.iterator()) File "/Library/Python/2.6/site-packages/django/db/models/query.py", line 251, in iterator obj = self.model(*row[index_start:aggregate_start]) File "/Library/Python/2.6/site-packages/django/db/models/base.py", line [...]]]></description>
			<content:encoded><![CDATA[<p>Having recently upgraded to Django 1.1, I suddenly started getting the error messages that look like:</p>
<pre>  File "/Library/Python/2.6/site-packages/django/db/models/fields/related.py", line 257, in __get__
    rel_obj = QuerySet(self.field.rel.to).get(**params)
  File "/Library/Python/2.6/site-packages/django/db/models/query.py", line 300, in get
    num = len(clone)
  File "/Library/Python/2.6/site-packages/django/db/models/query.py", line 81, in __len__
    self._result_cache = list(self.iterator())
  File "/Library/Python/2.6/site-packages/django/db/models/query.py", line 251, in iterator
    obj = self.model(*row[index_start:aggregate_start])
  File "/Library/Python/2.6/site-packages/django/db/models/base.py", line 324, in __init__
    signals.post_init.send(sender=self.__class__, instance=self)
  File "/Library/Python/2.6/site-packages/django/dispatch/dispatcher.py", line 166, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/Library/Python/2.6/site-packages/django/db/models/fields/files.py", line 368, in update_dimension_fields
    (self.width_field and not getattr(instance, self.width_field))
AttributeError: 'Icon' object has no attribute 'width'</pre>
<p>The issue turns out to be that you can&#8217;t just define the <code>ImageField</code> in your model, you also have to explicitly define the fields that will store the width and height fields for the image field. The sql generation tools for Django don&#8217;t do it for you.</p>
<p>For various reasons, I can&#8217;t do that this at this moment so I made the following I hack which I strongly recommend you don&#8217;t use (for efficiency reasons, as with this the height &amp; width have to be computed every time you access the image). This is added to <code>site-packages/django/db/models/fields</code> around line 367.</p>
<pre>if self.width_field and not hasattr(instance, self.width_field):
     dimension_fields_filled = False
else:
     dimension_fields_filled = not(
          (self.width_field and not getattr(instance, self.width_field))
          or (self.height_field and not getattr(instance, self.height_field))
     )</pre>
<p>The proper solutions probably involve:</p>
<ul>
<li>not adding the hack above and explicitly adding the fields, as per <a href="http://code.djangoproject.com/ticket/11196">here</a></li>
<li> updating the documentation (<a href="http://docs.djangoproject.com/en/dev/ref/models/fields/#imagefield">here</a> and <a href="http://docs.djangoproject.com/en/dev/topics/files/#using-files-in-models">here</a>) to say &#8220;you also have to add the fields to the DB&#8221;</li>
<li>making <code>syncdb</code>/<code>sql</code> automatically generate the width &amp; height fields</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://code.davidjanes.com/blog/2009/11/16/django-1-1-and-imagefield/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fizz Buzz in one line of Python</title>
		<link>http://code.davidjanes.com/blog/2009/10/24/fizz-buzz-in-one-line-of-python/</link>
		<comments>http://code.davidjanes.com/blog/2009/10/24/fizz-buzz-in-one-line-of-python/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 10:58:30 +0000</pubDate>
		<dc:creator>David Janes</dc:creator>
				<category><![CDATA[code fragments]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://code.davidjanes.com/blog/?p=589</guid>
		<description><![CDATA[Since Libin points to &#8220;Fizz Buzz&#8221; in one line of Ruby, I feel it&#8217;s only fair to do it in one line of Python: print [ not i % 15 and "Fizz Buzz" or not i % 5 and "Buzz" or not i % 3 and "Fizz" or i for i in xrange(1, 101) ] [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.libinpan.com/2008/02/fizz-buzz-fizzbuzz/">Since Libin points to &#8220;Fizz Buzz&#8221; in one line of Ruby</a>, I feel it&#8217;s only fair to do it in one line of Python:</p>
<pre>print [ not i % 15 and "Fizz Buzz" or not i % 5 and "Buzz" or not i % 3 and "Fizz" or i for i in xrange(1, 101) ]</pre>
<p>My preference is to really have a few more brackets in there, for clarity but apparently terseness is considered a virtue in and off itself sometimes. There&#8217;s other implementations of this in one line of Python:</p>
<ul>
<li><a href="http://www.sogeti-phoenix.com/Blogs/category/FizzBuzz.aspx">Sogeti Phoenix</a></li>
<li><a href="http://codepad.org/xHBbgcnO">Scaevolus on Codepad</a> &#8211; have a drink before you look at this one</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://code.davidjanes.com/blog/2009/10/24/fizz-buzz-in-one-line-of-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

