<?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>snipeworld.com &#187; Python</title>
	<atom:link href="http://snipeworld.com/category/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://snipeworld.com</link>
	<description>The right man in the right place</description>
	<lastBuildDate>Mon, 28 Jun 2010 05:51:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Python __iter__ performance</title>
		<link>http://snipeworld.com/2009/10/07/python-__iter__-performance/</link>
		<comments>http://snipeworld.com/2009/10/07/python-__iter__-performance/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 09:10:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://snipeworld.com/?p=100</guid>
		<description><![CDATA[$ python -m timeit -r 1000 -s "bla=[1,2,3]" "for item in bla:" "  item"
1000000 loops, best of 1000: 0.306 usec per loop
$ python -m timeit -r 1000 -s "bla=[1,2,3]" "lista=bla.__iter__()" "while True:" "  try:" "    lista.next()" "  except:" "    break"
100000 loops, best of 1000: 3.13 usec per loop
__iter__ + try..except + while is round 11x [...]]]></description>
			<content:encoded><![CDATA[<pre>$ python -m timeit -r 1000 -s "bla=[1,2,3]" "for item in bla:" "  item"
1000000 loops, best of 1000: 0.306 usec per loop</pre>
<pre>$ python -m timeit -r 1000 -s "bla=[1,2,3]" "lista=bla.__iter__()" "while True:" "  try:" "    lista.next()" "  except:" "    break"
100000 loops, best of 1000: 3.13 usec per loop</pre>
<p>__iter__ + try..except + while is round 11x slower than &#8220;for in&#8221; loop.</p>
]]></content:encoded>
			<wfw:commentRss>http://snipeworld.com/2009/10/07/python-__iter__-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python &#8211; 5th place in TIOBE Programming Community Index</title>
		<link>http://snipeworld.com/2009/05/21/python-5th-place-in-tiobe-programming-community-index/</link>
		<comments>http://snipeworld.com/2009/05/21/python-5th-place-in-tiobe-programming-community-index/#comments</comments>
		<pubDate>Thu, 21 May 2009 18:22:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[tiobe]]></category>

		<guid isPermaLink="false">http://snipeworld.com/?p=76</guid>
		<description><![CDATA[Python has jumped from 6th to 5th place in TIOBE Programming Community Index (May 2009). Congratulations!  
]]></description>
			<content:encoded><![CDATA[<p>Python has jumped from 6th to 5th place in <a href="TIOBE Programming Community Index">TIOBE Programming Community Index</a> (May 2009). Congratulations! <img src='http://snipeworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://snipeworld.com/2009/05/21/python-5th-place-in-tiobe-programming-community-index/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Checking key in dictionary &#8211; performance experiment</title>
		<link>http://snipeworld.com/2009/05/20/checking-key-in-dictionary-performance/</link>
		<comments>http://snipeworld.com/2009/05/20/checking-key-in-dictionary-performance/#comments</comments>
		<pubDate>Wed, 20 May 2009 09:01:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[tests]]></category>

		<guid isPermaLink="false">http://snipeworld.com/?p=72</guid>
		<description><![CDATA[Little experiment:
python -m timeit -r 100 -s "d={'a':'1', 'b':'2', 'c':'3'}" "d.has_key('a')"
1000000 loops, best of 100: 0.361 usec per loop
python -m timeit -r 100 -s "d={'a':'1', 'b':'2', 'c':'3'}" "'a' in d"
10000000 loops, best of 100: 0.159 usec per loop
Checking if dictionary has key using &#8220;in&#8221; is faster than using has_key() method.
Tested in Python 2.6
]]></description>
			<content:encoded><![CDATA[<p>Little experiment:</p>
<pre>python -m timeit -r 100 -s "d={'a':'1', 'b':'2', 'c':'3'}" "d.has_key('a')"
1000000 loops, best of 100: 0.361 usec per loop</pre>
<pre>python -m timeit -r 100 -s "d={'a':'1', 'b':'2', 'c':'3'}" "'a' in d"
10000000 loops, best of 100: 0.159 usec per loop</pre>
<p>Checking if dictionary has key using &#8220;in&#8221; is faster than using has_key() method.</p>
<p>Tested in Python 2.6</p>
]]></content:encoded>
			<wfw:commentRss>http://snipeworld.com/2009/05/20/checking-key-in-dictionary-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to write and read array from cookie in Pylons</title>
		<link>http://snipeworld.com/2009/05/05/how-to-write-and-read-cookie-in-pylons/</link>
		<comments>http://snipeworld.com/2009/05/05/how-to-write-and-read-cookie-in-pylons/#comments</comments>
		<pubDate>Tue, 05 May 2009 08:04:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Pylons]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[cookies]]></category>
		<category><![CDATA[pylons]]></category>

		<guid isPermaLink="false">http://snipeworld.com/?p=68</guid>
		<description><![CDATA[How to write and read array from cookies ?
The easiest way to write an array in cookie is serialize it using pickle module and quote returned string with urllib module. For example:
import pickle, urllib
cookie = []
response.set_cookie('some_cookie', urllib.quote(pickle.dumps(cookie)))
And getting an array from cookie:
cookie = pickle.loads(str(urllib.unquote(request.cookies['some_cookie'])))

]]></description>
			<content:encoded><![CDATA[<p>How to write and read array from cookies ?</p>
<p>The easiest way to write an array in cookie is serialize it using pickle module and quote returned string with urllib module. For example:</p>
<pre>import pickle, urllib
cookie = []
response.set_cookie('some_cookie', urllib.quote(pickle.dumps(cookie)))</pre>
<p>And getting an array from cookie:</p>
<pre>cookie = pickle.loads(str(urllib.unquote(request.cookies['some_cookie'])))</pre>
<p><img id="kosa-target-image" style="position: absolute; visibility: hidden; z-index: 2147483647; left: 283px; top: 55px;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAUCAYAAACJfM0wAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAAB90RVh0U29mdHdhcmUATWFjcm9tZWRpYSBGaXJld29ya3MgOLVo0ngAAAAWdEVYdENyZWF0aW9uIFRpbWUAMDQvMDQvMDhrK9wWAAACA0lEQVQ4jbXVz0sUYRjA8e+u6xqlKJUaBZuUh6AfhyCEpUN/QIR0skMh6iHwsKe6lFu4HjpJhy5BS1CsZtDSrYMYdPHUZauDbhcpi7bEH2DOtjvP83aY3dFxxi1hfeAd3nlhPu/zPjPvOyHgKnsQEQDz60kaaKuTuRpqHxqMAKBWvVCoJOjAxqqj60Q1Y3fg05dWki/OMjt3+L+A+KklRvs+cia2VhtOTsYpN5wgl4nReTCM6s7o96UyA6kFkpNK9tZMEFx0B2bnO8hlYky/L5N9V2TDsinbgohi207fFqGxwZDoO0T67nEu9FseAyAMODWuNqC9LczUTBGrKIgqqgYRQdSgqogovy2b8YkCxzqiBBlOxuJ/earqIqqKbMfVsLYuGGMIMnb8KkTUk60HNwapTOqGCYLVDzdGDH9Km1mKiDOBMe4qmqJbl+g1wu5gtQGFZWHw8gFam/GXoILubwpxf+go336WCDJ8pYh35xkYayZ9J8aVi52+lZgt18VCif7RBeLd+X+XItX7nJHXyvkb6wD8eHOOqekVEuNffZM4icyR6s34SuGDTx/Jk715D4CTIy959XaFB0/n+Tw2TMu+jUDcMby3vg2yPW4/WuTxtYe0RJd9D9eKmodQT1eOxKVn9HR9qJZ1l3DABgGYuD7sdGR36CZsrFXqeNADhNijX9NfAyI+Sz1Sug0AAAAASUVORK5CYII=" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://snipeworld.com/2009/05/05/how-to-write-and-read-cookie-in-pylons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The easiest way to modify response headers in Pylons</title>
		<link>http://snipeworld.com/2009/04/24/the-easiest-way-to-modify-response-headers-in-pylons/</link>
		<comments>http://snipeworld.com/2009/04/24/the-easiest-way-to-modify-response-headers-in-pylons/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 11:40:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Pylons]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[headers]]></category>
		<category><![CDATA[pylons]]></category>

		<guid isPermaLink="false">http://snipeworld.com/?p=66</guid>
		<description><![CDATA[Remember the trick!
The easiest way to modify response headers in Pylons is add:
response.headerlist = [('Content-type', 'image/png')]
just before render() function.
]]></description>
			<content:encoded><![CDATA[<p>Remember the trick!</p>
<p>The easiest way to modify response headers in Pylons is add:</p>
<pre>response.headerlist = [('Content-type', 'image/png')]</pre>
<p>just before render() function.</p>
]]></content:encoded>
			<wfw:commentRss>http://snipeworld.com/2009/04/24/the-easiest-way-to-modify-response-headers-in-pylons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple solution &#8211; how to use own decorators in Pylons actions</title>
		<link>http://snipeworld.com/2009/04/09/decorators-in-pylons-actions/</link>
		<comments>http://snipeworld.com/2009/04/09/decorators-in-pylons-actions/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 10:55:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Pylons]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[pylons]]></category>

		<guid isPermaLink="false">http://snipeworld.com/?p=62</guid>
		<description><![CDATA[This is a simple solution to create own decorator function for any action in Pylons.
First, you have to import some functions:
from decorator import decorator
from pylons.decorators.util import get_pylons # to get request environment
Now create decorator function, for example myowndecorator:
def myowndecorator():
    def wrapper(func, *args, **kwargs):
        request = [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple solution to create own decorator function for any action in Pylons.</p>
<p>First, you have to import some functions:</p>
<pre>from decorator import decorator
from pylons.decorators.util import get_pylons # to get request environment</pre>
<p>Now create decorator function, for example myowndecorator:</p>
<pre>def myowndecorator():
    def wrapper(func, *args, **kwargs):
        request = get_pylons(args).request # use it for any operation with request
        # do something
        return func(*args, **kwargs)
    return decorator(wrapper)</pre>
<p>Save it in your project lib directory as mylib.py.</p>
<p>In last step you have to import function from you library, and use decorator in your controller:</p>
<pre>from myproject.lib.mylib import myowndecorator

class PanelController(BaseController):
    @myowndecorator()
    def index(self):
        return render('/panel/index.mako')</pre>
]]></content:encoded>
			<wfw:commentRss>http://snipeworld.com/2009/04/09/decorators-in-pylons-actions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pylons 0.9.7 has been released</title>
		<link>http://snipeworld.com/2009/02/24/pylons-0-9-7/</link>
		<comments>http://snipeworld.com/2009/02/24/pylons-0-9-7/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 20:39:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://snipeworld.com/?p=28</guid>
		<description><![CDATA[New version(0.9.7) of Pylons framework has been released. It&#8217;s a big step to standardize code and documentation  
Major changes:

Switched to using WebOb for the request/response object
Various performance improvements to object initialization
Beaker and Routes updates
Middleware improvements, and optimizations

]]></description>
			<content:encoded><![CDATA[<p>New version(0.9.7) of <a href="http://pylonshq.com">Pylons framework</a> has been released. It&#8217;s a big step to standardize code and documentation <img src='http://snipeworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Major changes:</p>
<ul>
<li>Switched to using WebOb for the request/response object</li>
<li>Various performance improvements to object initialization</li>
<li>Beaker and Routes updates</li>
<li>Middleware improvements, and optimizations</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://snipeworld.com/2009/02/24/pylons-0-9-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Pylons Site</title>
		<link>http://snipeworld.com/2009/01/22/new-pylons-site/</link>
		<comments>http://snipeworld.com/2009/01/22/new-pylons-site/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 18:01:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[pylons]]></category>

		<guid isPermaLink="false">http://snipeworld.com/?p=12</guid>
		<description><![CDATA[I have noticed today pylonshq.com has new website   It&#8217;s prettier than last one. and I hope it&#8217;s announce, that new stable version(0.9.7) of Pylons is comming soon  
]]></description>
			<content:encoded><![CDATA[<p>I have noticed today pylonshq.com has new website <img src='http://snipeworld.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It&#8217;s prettier than last one. and I hope it&#8217;s announce, that new stable version(0.9.7) of Pylons is comming soon <img src='http://snipeworld.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://snipeworld.com/2009/01/22/new-pylons-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
