<?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>Ponton&#039;s site &#187; python</title>
	<atom:link href="http://www.ponton.srednikpe.org/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ponton.srednikpe.org</link>
	<description>blog głównie matematyczno-informatyczny (nie chce mi się pisać o życiu)</description>
	<lastBuildDate>Mon, 18 Jan 2010 22:23:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How not to name variables</title>
		<link>http://www.ponton.srednikpe.org/2009/06/13/how-not-to-name-variables/</link>
		<comments>http://www.ponton.srednikpe.org/2009/06/13/how-not-to-name-variables/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 18:00:31 +0000</pubDate>
		<dc:creator>ponton</dc:creator>
				<category><![CDATA[Computer science and math]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Real life]]></category>
		<category><![CDATA[idiot]]></category>
		<category><![CDATA[narzekanie]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ur doin it wrong]]></category>

		<guid isPermaLink="false">http://www.ponton.srednikpe.org/2009/06/13/how-not-to-name-variables/</guid>
		<description><![CDATA[This is is a Python line of code which I found in my project I work with two colleagues: for mid, mda, xmht, xmat, mhs, mas, mehs, meas, mphs, mpas, mrou in q: # .... No comments.]]></description>
			<content:encoded><![CDATA[<p>This is is a Python line of code which I found in my project I work with two colleagues:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">for</span> mid, mda, xmht, xmat, mhs, mas, mehs, meas, mphs, mpas, mrou <span style="color: #ff7700;font-weight:bold;">in</span> q:
    <span style="color: #808080; font-style: italic;"># ....</span></pre></div></div>

<p>No comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ponton.srednikpe.org/2009/06/13/how-not-to-name-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kości</title>
		<link>http://www.ponton.srednikpe.org/2008/08/30/kosci/</link>
		<comments>http://www.ponton.srednikpe.org/2008/08/30/kosci/#comments</comments>
		<pubDate>Sat, 30 Aug 2008 00:18:12 +0000</pubDate>
		<dc:creator>ponton</dc:creator>
				<category><![CDATA[Computer science and math]]></category>
		<category><![CDATA[Polskie]]></category>
		<category><![CDATA[my code]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.ponton.srednikpe.org/?p=104</guid>
		<description><![CDATA[Nie mieliśmy kości na sesję, to trzeba było coś napisać. NWOD-owy rzucacz kośćmi w Pythonie: #!/usr/bin/python &#160; import time import random import sys &#160; # argumenty: ile_scian = int&#40;sys.argv&#91;1&#93;&#41; # ilusciennymi koscmi rzucamy sukces = int&#40;sys.argv&#91;2&#93;&#41; # od ilu oczek jest sukces ile_rzutow = int&#40;sys.argv&#91;3&#93;&#41; # ile razy rzucamy &#160; def kostka&#40;sciany&#41;: rzut = random.randint&#40;1, [...]]]></description>
			<content:encoded><![CDATA[<p>Nie mieliśmy kości na sesję, to trzeba było coś napisać. NWOD-owy rzucacz kośćmi w Pythonie:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">time</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">random</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># argumenty: </span>
ile_scian = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>    <span style="color: #808080; font-style: italic;"># ilusciennymi koscmi rzucamy</span>
sukces = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>       <span style="color: #808080; font-style: italic;"># od ilu oczek jest sukces</span>
ile_rzutow = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">3</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>   <span style="color: #808080; font-style: italic;"># ile razy rzucamy</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> kostka<span style="color: black;">&#40;</span>sciany<span style="color: black;">&#41;</span>:
    rzut = <span style="color: #dc143c;">random</span>.<span style="color: black;">randint</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>, sciany<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> rzut
    <span style="color: #ff7700;font-weight:bold;">return</span> rzut
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'------------------------------'</span>
&nbsp;
<span style="color: #dc143c;">random</span>.<span style="color: black;">seed</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
sukcesy = <span style="color: #ff4500;">0</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, ile_rzutow<span style="color: black;">&#41;</span>:
    rzut = kostka<span style="color: black;">&#40;</span>ile_scian<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">if</span> rzut <span style="color: #66cc66;">&gt;</span>= sukces:
        sukcesy += <span style="color: #ff4500;">1</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">while</span> rzut == ile_scian:
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Przerzut!'</span>
&nbsp;
        rzut = kostka<span style="color: black;">&#40;</span>ile_scian<span style="color: black;">&#41;</span>
&nbsp;
        <span style="color: #ff7700;font-weight:bold;">if</span> rzut <span style="color: #66cc66;">&gt;</span>= sukces:
            sukcesy += <span style="color: #ff4500;">1</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Sukcesy: &quot;</span>, sukcesy</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.ponton.srednikpe.org/2008/08/30/kosci/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>pyhttpd &#8211; a tiny HTTP deamon written in Python</title>
		<link>http://www.ponton.srednikpe.org/2008/02/11/pyhttpd-a-tiny-http-deamon-written-in-python/</link>
		<comments>http://www.ponton.srednikpe.org/2008/02/11/pyhttpd-a-tiny-http-deamon-written-in-python/#comments</comments>
		<pubDate>Mon, 11 Feb 2008 18:21:24 +0000</pubDate>
		<dc:creator>ponton</dc:creator>
				<category><![CDATA[Computer science and math]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[my code]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.ponton.srednikpe.org/2008/02/11/pyhttpd-a-tiny-http-deamon-written-in-python/</guid>
		<description><![CDATA[It&#8217;s for my Python Course. It provides only very basic HTTP, but yet can be used for simple WWW hosting. Source. Features: GET and POST methods New thread for new connection Directory listing Error pages Document index Deafult type and charset Python scripts ;) Configuration file &#8230; and my own modules to handle these TODOs: [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s for my Python Course. It provides only very basic HTTP, but yet can be used for simple WWW hosting. <a title="pyhttpd" href="http://www.srednikpe.org/src/pyhttpd/">Source</a>.</p>
<p>Features:</p>
<ul>
<li>GET and POST methods</li>
<li>New thread for new connection</li>
<li>Directory listing</li>
<li>Error pages</li>
<li>Document index</li>
<li>Deafult type and charset</li>
<li>Python scripts ;)</li>
<li>Configuration file</li>
<li>&#8230; and my own modules to handle these</li>
</ul>
<p>TODOs:</p>
<ul>
<li>Logging</li>
<li>Much more stability (exceptions handling, etc.)</li>
<li>Sending gzipped or chunked data (if accepted)</li>
<li>Range headers</li>
<li>&#8230; and many, many other</li>
</ul>
<p>To run just edit pyhttpd.conf and change Port and Document root. Then type &#8220;python pyhttpd.py&#8221; and it should be now listening for connections.</p>
<p>How to run a python script and its output send to client? Pyhttpd checks if the requesting file is a python one. If so then it opens a python interpreter by a pipe, sends _GET and _POST dictionaries and file contents. And finally, sends interpreter outputs to client.</p>
<p>_GET and_POST are just dictionaries with variable names as keys. So if there is a foobar.py?i=500 request then _GET will be { &#8216;i&#8217; : &#8217;500&#8242; } (note that this is always a string value).</p>
<p>It&#8217;s GPL if someone asked.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ponton.srednikpe.org/2008/02/11/pyhttpd-a-tiny-http-deamon-written-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
