<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr - freephys</title>
<link>http://snipplr.com/users/freephys</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Wed, 22 May 2013 19:08:21 GMT</pubDate>
<item>
<title>(Bash) zenity dialog examples</title>
<link>http://snipplr.com/view/39031/zenity-dialog-examples/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Fri, 13 Aug 2010 14:02:32 GMT</pubDate>
<guid>http://snipplr.com/view/39031/zenity-dialog-examples/</guid>
</item>
<item>
<title>(Bash) Find total size for some files</title>
<link>http://snipplr.com/view/39030/find-total-size-for-some-files/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Fri, 13 Aug 2010 13:58:51 GMT</pubDate>
<guid>http://snipplr.com/view/39030/find-total-size-for-some-files/</guid>
</item>
<item>
<title>(Bash) Install Multi OS on Mac: step 1 , partition with diskutil</title>
<link>http://snipplr.com/view/38556/install-multi-os-on-mac-step-1--partition-with-diskutil/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Fri, 06 Aug 2010 01:37:37 GMT</pubDate>
<guid>http://snipplr.com/view/38556/install-multi-os-on-mac-step-1--partition-with-diskutil/</guid>
</item>
<item>
<title>(Bash) rEFItBlesser</title>
<link>http://snipplr.com/view/38244/refitblesser/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Tue, 03 Aug 2010 02:45:05 GMT</pubDate>
<guid>http://snipplr.com/view/38244/refitblesser/</guid>
</item>
<item>
<title>(Bash) enbale.sh</title>
<link>http://snipplr.com/view/38239/enbalesh/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Tue, 03 Aug 2010 00:46:18 GMT</pubDate>
<guid>http://snipplr.com/view/38239/enbalesh/</guid>
</item>
<item>
<title>(Python) 8.4. Trapping and Recording Exceptions</title>
<link>http://snipplr.com/view/25018/84-trapping-and-recording-exceptions/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Fri, 18 Dec 2009 11:18:29 GMT</pubDate>
<guid>http://snipplr.com/view/25018/84-trapping-and-recording-exceptions/</guid>
</item>
<item>
<title>(Python) print_exc_plus : 8.6. Getting More Information from Tracebacks</title>
<link>http://snipplr.com/view/25014/printexcplus--86-getting-more-information-from-tracebacks/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Fri, 18 Dec 2009 10:51:36 GMT</pubDate>
<guid>http://snipplr.com/view/25014/printexcplus--86-getting-more-information-from-tracebacks/</guid>
</item>
<item>
<title>(Python) Debugging/logging CGI script in Python</title>
<link>http://snipplr.com/view/25011/debugginglogging-cgi-script-in-python/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Fri, 18 Dec 2009 10:34:20 GMT</pubDate>
<guid>http://snipplr.com/view/25011/debugginglogging-cgi-script-in-python/</guid>
</item>
<item>
<title>(Perl) Example of circular data structure : Network class</title>
<link>http://snipplr.com/view/24163/example-of-circular-data-structure--network-class/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Wed, 02 Dec 2009 21:49:47 GMT</pubDate>
<guid>http://snipplr.com/view/24163/example-of-circular-data-structure--network-class/</guid>
</item>
<item>
<title>(Perl) benchmark</title>
<link>http://snipplr.com/view/24084/benchmark/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Tue, 01 Dec 2009 22:36:08 GMT</pubDate>
<guid>http://snipplr.com/view/24084/benchmark/</guid>
</item>
<item>
<title>(Python) Determine if a Sequence is in another sequence in Python</title>
<link>http://snipplr.com/view/20626/determine-if-a-sequence-is-in-another-sequence-in-python/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sun, 04 Oct 2009 00:48:47 GMT</pubDate>
<guid>http://snipplr.com/view/20626/determine-if-a-sequence-is-in-another-sequence-in-python/</guid>
</item>
<item>
<title>(Python) Determine if a Sequence is in another sequence in Python : solution 1</title>
<link>http://snipplr.com/view/20625/determine-if-a-sequence-is-in-another-sequence-in-python--solution-1/</link>
<description><![CDATA[ <p>This is a generalization of the "string contains substring" problem to (more) arbitrary types.

Given an sequence (such as a list or tuple), what's the best way of determining whether another sequence is inside it? As a bonus, it should return the index of the element where the subsequence starts:

Example usage (Sequence in Sequence):

>>> seq_in_seq([5,6],  [4,'a',3,5,6])
3
>>> seq_in_seq([5,7],  [4,'a',3,5,6])
-1 # or None, or whatever

I second the Knuth-Morris-Pratt algorithm. By the way, your problem (and the KMP solution) is exactly recipe 5.13 in Python Cookbook 2nd edition. You can find the related code at http://code.activestate.com/recipes/117214/

It finds all the correct subsequences in a given sequence, and should be used as an iterator:

For larger ones, look at the Aho-Corasick algorithm.</p> ]]></description>
<pubDate>Sun, 04 Oct 2009 00:46:40 GMT</pubDate>
<guid>http://snipplr.com/view/20625/determine-if-a-sequence-is-in-another-sequence-in-python--solution-1/</guid>
</item>
<item>
<title>(Python) Reading multiple lines into list : solution 2</title>
<link>http://snipplr.com/view/20624/reading-multiple-lines-into-list--solution-2/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sun, 04 Oct 2009 00:39:57 GMT</pubDate>
<guid>http://snipplr.com/view/20624/reading-multiple-lines-into-list--solution-2/</guid>
</item>
<item>
<title>(Python) cStringIO 1</title>
<link>http://snipplr.com/view/20621/cstringio-1/</link>
<description><![CDATA[ <p>cStringIO -- Faster version of StringIO</p> ]]></description>
<pubDate>Sun, 04 Oct 2009 00:31:07 GMT</pubDate>
<guid>http://snipplr.com/view/20621/cstringio-1/</guid>
</item>
</channel>
</rss>