<?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 Lynch &#187; python</title>
	<atom:link href="http://davidlynch.org/blog/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidlynch.org/blog</link>
	<description>has a blog</description>
	<lastBuildDate>Fri, 18 Jun 2010 07:37:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Creating an image map from SVG</title>
		<link>http://davidlynch.org/blog/2008/03/creating-an-image-map-from-svg/</link>
		<comments>http://davidlynch.org/blog/2008/03/creating-an-image-map-from-svg/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 18:55:43 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[svg]]></category>

		<guid isPermaLink="false">http://davidlynch.org/blog/2008/03/creating-an-image-map-from-svg/</guid>
		<description><![CDATA[I was asked how I made the map in my examples earlier. I wrote a small script to do it. (The script is quite limited &#8212; I only made it complete enough to handle the SVG files I was using. Others might break it. Also, it requires pyparsing&#8230; and hoo-boy is that slow.) Example! Wikipedia [...]]]></description>
			<content:encoded><![CDATA[<p>I was asked how I made 
<a  href="http://davidlynch.org/js/maphilight/docs/demo_world.html">the map</a> in my examples earlier.</p>
<p>I wrote 
<a  href="http://davidlynch.org/toys/svg2imagemap.zip">a small script</a> to do it.  (The script is quite limited &#8212; I only made it complete enough to handle the SVG files I was using.  Others might break it.  Also, it requires pyparsing&#8230; and hoo-boy is that slow.)</p>
<p>Example!</p>
<p>Wikipedia is good for this, and has provided me with the example file I&#8217;ll use, 
<a  href="http://en.wikipedia.org/wiki/Image:Map_of_USA_with_state_names.svg">a map of the USA</a>.  If you have some GIS data already, I believe that ArcGIS 9.2 has native SVG support, or it looks like you can convert ESRI shapefiles with 
<a  href="http://www.carto.net/papers/svg/utils/shp2svg/">shp2svg</a>.</p>
<p>My example file is filled with all sort of crud that isn&#8217;t a definition of state boundaries, though, so I need to get just that.  Perusing it (in a text editor or a SVG editor like Inkscape) reveals that all the state borders are in a group named &#8220;States&#8221;.  Helpful!</p>
<p>So I run my script: <code>svg2imagemap.py Map_of_USA_with_state_names.svg 960 593 States</code></p>
<p>(The &#8220;960 593&#8243; is the size of the image I&#8217;m creating from the SVG file.)</p>
<p>This creates an html file named [svg name].html, so Map_of_USA_with_state_names.html.  It only contains the area tags, so I dump them into an image map in a page set up like the one in the other examples&#8230;</p>
<p>And we get: 
<a  href="http://davidlynch.org/js/maphilight/docs/demo_usa.html">A map of the USA</a>.</p>
<p>Just to disclaim again: That script is unlikely to be immediately useful for any particular SVG image.  You would almost certainly need to tweak it significantly to make it work for your purposes.  But it&#8217;s a good start, at least.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlynch.org/blog/2008/03/creating-an-image-map-from-svg/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Python whitespace doesn&#8217;t matter</title>
		<link>http://davidlynch.org/blog/2007/12/python-whitespace-doesnt-matter/</link>
		<comments>http://davidlynch.org/blog/2007/12/python-whitespace-doesnt-matter/#comments</comments>
		<pubDate>Fri, 14 Dec 2007 21:50:40 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://davidlynch.org/blog/2007/12/python-whitespace-doesnt-matter/</guid>
		<description><![CDATA[If you have some programming experience then there is one particular feature of Python that is likely to turn you off. Whitespace matters. Indentation is significant. This comes as a shock to many people who are used to it being meaningless. Most languages in common use designate code blocks with braces ({ ... }), or [...]]]></description>
			<content:encoded><![CDATA[<p>If you have some programming experience then there is one particular feature of Python that is likely to turn you off.</p>
<p>Whitespace matters.  Indentation is <em>significant</em>.</p>
<p>This comes as a shock to many people who are used to it being meaningless.  Most languages in common use designate code blocks with braces (<code>{ ... }</code>), or in some cases special keywords (e.g. Lua&#8217;s <code>do/then ... end</code>).  If you want to write your program without any indentation whatsoever then it won&#8217;t stop you.</p>
<p>So having to pay attention to whitespace worries people.  Puts them off trying Python.  Makes them chafe at the thought of using it.  Their freedom is being abridged!</p>
<p>This is really weird, since <em>everyone</em> agrees that consistent indentation is a good idea.  In fact, it&#8217;s about the easiest and most effective thing you can do to make your code legible.</p>
<p>This is why objecting to syntactically meaningful whitespace in Python is a straw-man.  All it&#8217;s doing is requiring you to not write unreadable and misleading code.  In fact, if you have good habits already then you will never notice it.  Ever.</p>
<p>(This post is an example of low-hanging fruit for a programming blog.  Something to post about early on, for the sake of getting your opinion out there.)</p>
]]></content:encoded>
			<wfw:commentRss>http://davidlynch.org/blog/2007/12/python-whitespace-doesnt-matter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
