<?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/">
<channel>
	<title>Comments on: Usefulness of itertools.cycle &#038; re.sub</title>
	<link>http://ramblings.timgolden.me.uk/2009/11/16/usefulness-of-itertoolscycle-resub/</link>
	<description>The ramblings of Tim Golden</description>
	<pubDate>Fri, 12 Mar 2010 00:16:22 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2</generator>

	<item>
		<title>By: tim</title>
		<link>http://ramblings.timgolden.me.uk/2009/11/16/usefulness-of-itertoolscycle-resub/#comment-1045</link>
		<author>tim</author>
		<pubDate>Mon, 16 Nov 2009 13:58:13 +0000</pubDate>
		<guid>http://ramblings.timgolden.me.uk/2009/11/16/usefulness-of-itertoolscycle-resub/#comment-1045</guid>
		<description>Heh. If it had taken me more than the 10 minutes it did to do what I described above I'd have looked around for the obviously-must-be-there prior art. ISTR that Sphinx uses Smartypants, so I'd have got there pretty fast. Thanks for the link.</description>
		<content:encoded><![CDATA[<p>Heh. If it had taken me more than the 10 minutes it did to do what I described above I&#8217;d have looked around for the obviously-must-be-there prior art. ISTR that Sphinx uses Smartypants, so I&#8217;d have got there pretty fast. Thanks for the link.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tim</title>
		<link>http://ramblings.timgolden.me.uk/2009/11/16/usefulness-of-itertoolscycle-resub/#comment-1044</link>
		<author>tim</author>
		<pubDate>Mon, 16 Nov 2009 13:55:25 +0000</pubDate>
		<guid>http://ramblings.timgolden.me.uk/2009/11/16/usefulness-of-itertoolscycle-resub/#comment-1044</guid>
		<description>Thanks, Tom. I knew there'd be a good regex solution; I always seem to spend a few minutes poking at more-than-trivial regexes before giving up in disgust at my ignorance and producing solutions like the above. Thanks for the typo report, too. Fixed now.

I suppose I could argue that my solution would scale better to some hypothetical need to cycle round three things but frankly I'd be scrambling for self-justification :)</description>
		<content:encoded><![CDATA[<p>Thanks, Tom. I knew there&#8217;d be a good regex solution; I always seem to spend a few minutes poking at more-than-trivial regexes before giving up in disgust at my ignorance and producing solutions like the above. Thanks for the typo report, too. Fixed now.</p>
<p>I suppose I could argue that my solution would scale better to some hypothetical need to cycle round three things but frankly I&#8217;d be scrambling for self-justification :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Lynn</title>
		<link>http://ramblings.timgolden.me.uk/2009/11/16/usefulness-of-itertoolscycle-resub/#comment-1043</link>
		<author>Tom Lynn</author>
		<pubDate>Mon, 16 Nov 2009 13:55:13 +0000</pubDate>
		<guid>http://ramblings.timgolden.me.uk/2009/11/16/usefulness-of-itertoolscycle-resub/#comment-1043</guid>
		<description>There's also the smartypants module to do this, if you prefer.

http://pypi.python.org/pypi/smartypants/</description>
		<content:encoded><![CDATA[<p>There&#8217;s also the smartypants module to do this, if you prefer.</p>
<p><a href="http://pypi.python.org/pypi/smartypants/" rel="nofollow">http://pypi.python.org/pypi/smartypants/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom Lynn</title>
		<link>http://ramblings.timgolden.me.uk/2009/11/16/usefulness-of-itertoolscycle-resub/#comment-1042</link>
		<author>Tom Lynn</author>
		<pubDate>Mon, 16 Nov 2009 13:51:45 +0000</pubDate>
		<guid>http://ramblings.timgolden.me.uk/2009/11/16/usefulness-of-itertoolscycle-resub/#comment-1042</guid>
		<description>You've got a typo: "&ldqot;".

More importantly, the magic here is coming from the re module, not itertools. I'd have used::

    text = re.sub(r'"([^"]*)"', r'&ldquot;\1&rdquot;', text)</description>
		<content:encoded><![CDATA[<p>You&#8217;ve got a typo: &#8220;&ldqot;&#8221;.</p>
<p>More importantly, the magic here is coming from the re module, not itertools. I&#8217;d have used::</p>
<p>    text = re.sub(r&#8217;&#8221;([^&#8221;]*)&#8221;&#8216;, r&#8217;&ldquot;\1&rdquot;&#8217;, text)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
