<?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>bgola &#187; python</title>
	<atom:link href="http://blog.brunogola.com.br/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.brunogola.com.br</link>
	<description>python, free software, hacking, free culture, bicycle commuting, geocaching</description>
	<lastBuildDate>Mon, 21 Jun 2010 20:14:37 +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>São Paulo Python User Group &#8211; May Meeting</title>
		<link>http://blog.brunogola.com.br/2009/05/sao-paulo-python-user-group-may-meeting/</link>
		<comments>http://blog.brunogola.com.br/2009/05/sao-paulo-python-user-group-may-meeting/#comments</comments>
		<pubDate>Sat, 16 May 2009 13:29:01 +0000</pubDate>
		<dc:creator>Bruno Gola</dc:creator>
				<category><![CDATA[Hacklab]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[fisl]]></category>
		<category><![CDATA[grupy-sp]]></category>
		<category><![CDATA[pythonbrasil]]></category>

		<guid isPermaLink="false">http://blog.brunogola.com.br/?p=76</guid>
		<description><![CDATA[Every month the GruPy-SP members get together to discuss, chat and/or code. This month we will meet to watch/present some lightning talks and to talk about our participation at the Fórum Internacional de Software Livre (FISL 10). The meeting will be hold at the SP HackLab, May 23. More details (in pt-br): GruPy-SP wiki. See [...]]]></description>
			<content:encoded><![CDATA[<p>Every month the <a href="http://www.python.org.br/wiki/GrupySP">GruPy-SP</a> members get together to discuss, chat and/or code. </p>
<p>This month we will meet to watch/present some lightning talks and to talk about our participation at the Fórum Internacional de Software Livre (<a href="http://www.fisl.org.br/">FISL 10</a>). </p>
<p>The meeting will be hold at the SP HackLab, May 23. More details (in pt-br): <a href="http://www.python.org.br/wiki/GrupySP">GruPy-SP wiki</a>.</p>
<p>See you there <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brunogola.com.br/2009/05/sao-paulo-python-user-group-may-meeting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nokia Code Camp São Paulo</title>
		<link>http://blog.brunogola.com.br/2008/10/nokia-code-camp-sao-paulo/</link>
		<comments>http://blog.brunogola.com.br/2008/10/nokia-code-camp-sao-paulo/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 18:17:10 +0000</pubDate>
		<dc:creator>Bruno Gola</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[e71]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[n95]]></category>
		<category><![CDATA[nokia]]></category>
		<category><![CDATA[nokia code camp]]></category>

		<guid isPermaLink="false">http://blog.brunogola.com.br/?p=65</guid>
		<description><![CDATA[Last Friday (Oct 25) I&#8217;ve attended to the Forum Nokia Code Camp here in São Paulo. I must admit that the main motivation to go was that the place was very near my house After finding out that rbp, lhonda and Luiz Irber (friends from our local Python User Group) were attending too I thought [...]]]></description>
			<content:encoded><![CDATA[<p>Last Friday (Oct 25) I&#8217;ve attended to the <em>Forum Nokia Code Camp</em> here in São Paulo. I must admit that the main motivation to go was that the place was very near my house <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> </p>
<p>After finding out that rbp, lhonda and Luiz Irber (friends from our local Python User Group) were attending too I thought that it&#8217;d be a nice event. At least we could talk about GruPy-SP plans&#8230;</p>
<p>Anyway, I went to the hotel and after watching the three presentations (speaking about Nokia Serie60, Python and mobile development) the fun really started. 4 hours to develop the coolest mobile application in the world <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> </p>
<p>The prize was two E71 (the &#8220;new&#8221; Nokia Smartphone) for the &#8220;winner&#8221; application, so we decided to code in pairs. Me and rbp, after talking about our ideas, decided to write a musical instrument using the N95 accelerometer. </p>
<p>The first two hours of &#8220;development&#8221; actually we spent trying to find a proper way to transfer files to our cellphones (the S60 SDK is Windows only&#8230;). Then, with the &#8220;bluetooth easiest method&#8221; for transferring the app working, we started trying to find out how to interpret the accelerometer data. It worked as expected. Then we needed to play a sound (as it was a <em>musical</em> instrument). Easy, Python for S60 is very intuitive, the API is very High Level. Looking to the reference guide there was something like:</p>
<blockquote><p>
from audio import Sound<br />
Sound.open(&#8220;file.mp3&#8243;).play()
</p></blockquote>
<p>Just as I expected&#8230; except that there wasn&#8217;t any sound coming from the <em>freakin&#8217; phone&#8217;s speaker</em>. There was forty minutes left to the end of the competition and all we had was a <em>soundless musical instrument</em>, not very useful. </p>
<p>Ok, plan B. I started looking to some old code in my N95 and found a bluetooth webcam prototype. Rbp had an idea of making the webcam &#8220;crash&#8221; with a movement (using the accelerometer). And then we made it. </p>
<p>It&#8217;s a funny application and, as I said to rbp, as programmers we are great comedians. We presented the webcam in the stage and people seemed to like us (the app or the comedians? I really don&#8217;t know <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> )</p>
<p>Well, me and rbp won a Nokia E71 (each), it&#8217;s a very nice (and THIN) smartphone, I don&#8217;t like phones with qwerty keyboards, but this one is really cool (thin, small and <em>almost</em> comfortable to type). </p>
<p><a href="http://w<br />
ww.flickr.com/photos/brunogola/2979080960/" title="10/27/2008 by Bruno Gola, on Flickr"><img src="http://farm4.static.flickr.com/3073/2979080960_7848b3d4eb.jpg" width="500" height="375" alt="10/27/2008" /></a></p>
<p>Thanks Forum Nokia! <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brunogola.com.br/2008/10/nokia-code-camp-sao-paulo/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>DjangoCon day two</title>
		<link>http://blog.brunogola.com.br/2008/09/djangocon-day-two/</link>
		<comments>http://blog.brunogola.com.br/2008/09/djangocon-day-two/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 03:41:47 +0000</pubDate>
		<dc:creator>Bruno Gola</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[djangocon]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[grupy]]></category>
		<category><![CDATA[grupy-sp]]></category>

		<guid isPermaLink="false">http://blog.brunogola.com.br/?p=60</guid>
		<description><![CDATA[Almost sleeping, but there&#8217;s still a bit of caffeine in my body to write this post. Some notes on day two: In São Paulo we had two lighting talks before the &#8220;official&#8221; conference. João (JS) talked about a little script he wrote that uses PyGame to display text from a .txt file in a presentation [...]]]></description>
			<content:encoded><![CDATA[<p>Almost sleeping, but there&#8217;s still a bit of caffeine in my body to write this post.</p>
<p>Some notes on day two:</p>
<ul>
<li>In São Paulo we had two lighting talks before the &#8220;official&#8221; conference. João (<em>JS</em>) talked about a little script he wrote that uses PyGame to display text from a .txt file in a presentation format. <a href="http://isnomore.net">Rbp</a> explained a bit about 2to3  (the Python 2.x [actually x <em>equals</em> 6] to Python 3 conversion tool) and showed some examples.</li>
<li>First talk. Mark Ramm had some <strong>good</strong> points. Specially, IMO, about making Django more <em>modular</em>, which means that each part of it doesn&#8217;t depend on other parts of the framework. As an example, you can choose to use the Django ORM without using <em>Django</em>. But, please, don&#8217;t make it a lot of little packages that you need to grab together to start using the framework. One of the nice things about Django is that it&#8217;s simple to start using it (install one package and then <em>django-admin.py startproject</em>)</li>
<li><em>Official</em> lighting talks. As always, a great moment on any Python conference. Lots of curious and interesting stuff (and other stuff not so interesting&#8230; or not interesting at all <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' />  [for me, obviously]). Funny moment: <strong>People, don&#8217;t use GMail over HTTP, there IS HTTPS support</strong> <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
<li>Schema evolution, three options: DMigration, <a href="http://south.aeracode.org/">South</a> and Django Evolution. There are a lot of doubts about each one and I think I need to test all of them to choose one (and hope that they start collaborating to each other and make something <em>really good</em>). But it&#8217;s great to see that there is people working on that.</li>
<li>Last talk was <em>Django&#8217;s Future</em> by, obviously, Jacob and Adrian. It was more like a chat between them. Some good ideas and discussions. Then they received questions/requests/suggestions from the public. Things like, <em>dropping old python versions support</em>, <em>python 3 support</em>, <em>documentation</em>, <em>debugging tools</em>, etc. I think that some suggestions/requests were <strong>really</strong> nice and  I hope that Django developers (and the community) take them seriously. This was a great opportunity for developers to receive feedback from the community (users).</li>
</ul>
<p>That&#8217;s it for 2008. Again, I&#8217;d like to thank Rodolpho and Google for making it possible to attend to DjangoCon from São Paulo. Congratulations to DjangoCon organizers and to the Django community!</p>
<p>And, of course, thanks GruPy-SP people <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
<p>Pictures: <a href="http://flickr.com/photos/rbp/sets/72157607173551965/">Rbp&#8217;s DjangoCon set @ Flickr</a></p>
<p><img src='http://farm4.static.flickr.com/3256/2838745148_66db951462.jpg?v=0' alt='DjangoCon @ Google (SP)' class='aligncenter' /></p>
<p>It was 11p.m. Almost sleeping in this blue big puff <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brunogola.com.br/2008/09/djangocon-day-two/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DjangoCon first day</title>
		<link>http://blog.brunogola.com.br/2008/09/djangocon-first-day/</link>
		<comments>http://blog.brunogola.com.br/2008/09/djangocon-first-day/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 05:05:32 +0000</pubDate>
		<dc:creator>Bruno Gola</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[djangocon]]></category>
		<category><![CDATA[first day]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[são paulo]]></category>
		<category><![CDATA[talks]]></category>

		<guid isPermaLink="false">http://blog.brunogola.com.br/?p=57</guid>
		<description><![CDATA[I&#8217;m attending to DjangoCon from São Paulo Google&#8217;s Office. Some notes on the first day of event: I expected more news from GvR on his talk about GAE (nothing really new). David Cramer talk about High Performance was kinda heavy (but good things learned) The history behind Django is hilarious (State of Django by Jacob [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m attending to <a href="http://djangocon.org/">DjangoCon</a> from São Paulo Google&#8217;s Office. </p>
<p>Some notes on the first day of event:</p>
<ul>
<li>I expected more news from <em>GvR</em> on his talk about GAE (nothing <strong>really</strong> new).</li>
<li><em>David Cramer</em> talk about High Performance was kinda <em>heavy</em> (but good things learned)</li>
<li>The history behind Django is hilarious (<em>State of Django by Jacob and Adrian</em>)</li>
<li>It seems Django is getting bigger (contributors) and better (features). Good!</li>
<li>Really good talk by Malcolm Tredinnick about the Django ORM</li>
<li>GeoDjango seems very interesting, but it&#8217;s not for me (at least now&#8230;)</li>
<li>Cal Henderson made good &#8220;feature requests&#8221; and &#8220;bug reports&#8221; live, the unreadable SQL generated by Django scares me a bit&#8230; but not that much</li>
</ul>
<p>In general it was great. I can&#8217;t wait for the lighting talks tomorrow (probably the best moment on any Python conference <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ).</p>
<p>Oh, the snacks @ Google (Sao Paulo) are awesome!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brunogola.com.br/2008/09/djangocon-first-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Modifying Django NewForms-Admin views</title>
		<link>http://blog.brunogola.com.br/2008/09/modifying-django-newforms-admin-views/</link>
		<comments>http://blog.brunogola.com.br/2008/09/modifying-django-newforms-admin-views/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 12:22:31 +0000</pubDate>
		<dc:creator>Bruno Gola</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[add_view]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[customize]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[newforms]]></category>
		<category><![CDATA[newforms-admin]]></category>

		<guid isPermaLink="false">http://blog.brunogola.com.br/?p=56</guid>
		<description><![CDATA[Playing with the new Django features, specially with the NewForms-Admin, I was looking for a way to change the add view behavior for some models. It&#8217;s really easy and obvious (it&#8217;s always easy and obvious with Python and Django). First, you&#8217;ll need the admin.py file in your app directory. from django.contrib import admin from myproject.myapp.models [...]]]></description>
			<content:encoded><![CDATA[<p>Playing with the new <a href="http://www.djangoproject.com/">Django</a> features, specially with the NewForms-Admin, I was looking for a way to change the <em>add</em> view behavior for some <em>models</em>.</p>
<p>It&#8217;s really easy and obvious (it&#8217;s always easy and obvious with Python and Django).</p>
<p>First, you&#8217;ll need the <em>admin.py</em> file in your app directory.</p>
<p><code><br />
from django.contrib import admin<br />
from myproject.myapp.models import MyModel</p>
<p>class MyModelAdmin(admin.ModelAdmin):<br />
    def add_view(self, request):<br />
        if request.method == 'POST':<br />
            # do whatever you want<br />
            # remember, POSTing means that someone entered data.<br />
        return admin.ModelAdmin.add_view(self, request)</p>
<p>admin.site.register(MyModel, MyModelAdmin)<br />
</code></p>
<p>The <em>add_view</em> method is called when you try to <em>add</em> an entry using the admin. There are other interesting methods you should look too, for customizing the admin behavior (change_view, delete_view, etc).</p>
<p>Another way to customize things is to write your own <em>ModelForm</em>, but it&#8217;s beyond the scope of this post <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brunogola.com.br/2008/09/modifying-django-newforms-admin-views/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DjangoCon in São Paulo</title>
		<link>http://blog.brunogola.com.br/2008/09/djangocon-in-sao-paulo/</link>
		<comments>http://blog.brunogola.com.br/2008/09/djangocon-in-sao-paulo/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 17:13:18 +0000</pubDate>
		<dc:creator>Bruno Gola</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[djangocon]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://blog.brunogola.com.br/?p=54</guid>
		<description><![CDATA[I&#8217;m not crazy at all. (yet) Thanks to Google (I think specially to Rodolpho) DjangoCon will be transmitted to Google&#8217;s Office in São Paulo while the conference is held in Mountain View. Cool I&#8217;m definitively going! So, Saturday and Sunday (September 6th and 7th) @ Google&#8217;s Office, see you there!]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not crazy at all. (yet)</p>
<p>Thanks to Google (I think specially to <a href="http://rodolpho.eckhardt.com.br/blog/">Rodolpho</a>) DjangoCon will be transmitted to Google&#8217;s Office in São Paulo while the conference is held in Mountain View. </p>
<p>Cool <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I&#8217;m definitively going! So, Saturday and Sunday (September 6th and 7th) @ Google&#8217;s Office, see you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brunogola.com.br/2008/09/djangocon-in-sao-paulo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PyConBrasil 2008</title>
		<link>http://blog.brunogola.com.br/2008/08/pyconbrasil-2008/</link>
		<comments>http://blog.brunogola.com.br/2008/08/pyconbrasil-2008/#comments</comments>
		<pubDate>Sat, 09 Aug 2008 12:28:20 +0000</pubDate>
		<dc:creator>Bruno Gola</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[pyconbrasil]]></category>
		<category><![CDATA[pythonbrasil]]></category>
		<category><![CDATA[rio]]></category>
		<category><![CDATA[uva]]></category>

		<guid isPermaLink="false">http://blog.brunogola.com.br/?p=49</guid>
		<description><![CDATA[This year&#8217;s PyConBrasil will be held at Universidade Veiga de Almeida, Rio de Janeiro &#8211; RJ. I&#8217;m definitely going! Last year&#8217;s PyConBrasil was great. So, if you are in Brazil or planning come near September 18th, 19th and 20th, don&#8217;t miss the chance to meet the awesome guys from Python Brasil community]]></description>
			<content:encoded><![CDATA[<p>This year&#8217;s <a href="http://pyconbrasil.com.br">PyConBrasil</a> will be held at Universidade Veiga de Almeida, Rio de Janeiro &#8211; RJ. I&#8217;m definitely going! Last year&#8217;s PyConBrasil was great.</p>
<p>So, if you are in Brazil or planning come near September 18th, 19th and 20th, don&#8217;t miss the chance to meet the awesome guys from <a href="http://www.pythonbrasil.com.br">Python Brasil</a> community <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brunogola.com.br/2008/08/pyconbrasil-2008/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PyPy 2.5-features &#8211; Yet another status update</title>
		<link>http://blog.brunogola.com.br/2008/07/pypy-25-features-yet-another-status-update/</link>
		<comments>http://blog.brunogola.com.br/2008/07/pypy-25-features-yet-another-status-update/#comments</comments>
		<pubDate>Fri, 18 Jul 2008 03:27:29 +0000</pubDate>
		<dc:creator>Bruno Gola</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[pypy]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[import]]></category>
		<category><![CDATA[magic number]]></category>
		<category><![CDATA[opcodes]]></category>
		<category><![CDATA[pyc]]></category>
		<category><![CDATA[pycode]]></category>
		<category><![CDATA[status update]]></category>

		<guid isPermaLink="false">http://blog.brunogola.com.br/?p=44</guid>
		<description><![CDATA[Here comes another GSoC status update Some finished tasks: throw() method on generators close() method&#8230; faking 2.5 behavior for IMPORT_NAME and IMPORT_FROM opcodes changing the default value for magic attribute of PyCode objects changing the magic number that goes in .pyc files compiled by PyPy fixing tests and more tests&#8230; From those changes the only [...]]]></description>
			<content:encoded><![CDATA[<p>Here comes another GSoC status update <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Some finished tasks:</p>
<ul>
<li>throw() method on generators</li>
<li>close() method&#8230;</li>
<li>faking 2.5 behavior for IMPORT_NAME and IMPORT_FROM opcodes</li>
<li>changing the default value for <em>magic </em> attribute of PyCode objects</li>
<li>changing the magic number that goes in .pyc files compiled by PyPy</li>
<li>fixing tests and more tests&#8230;</li>
</ul>
<p>From those changes the only one I would like to comment is the change of both magic numbers. </p>
<p>First, they have different values and meanings in PyPy. The magic number for .pyc files (defined in <em>pypy/modules/__builtin__/importing.py</em>) is the number that identifies the bytecode &#8220;version&#8221;. It&#8217;s used to know if the interpreter should use the .pyc file or should recompile the .py. PyPy&#8217;s value is different from CPython&#8217;s one. As we are changing some opcodes (as IMPORT_NAME, mentioned before) this number had to be changed. The old value in PyPy was 1024 (or 1024 + 2 or 1024 + 4 or 1024 + 2 + 4, depending on some command line options), the new value is 1034 (or &#8230;.). We are just using the same policy CPython uses to change the value, add 10 to the old value.</p>
<p>Now the PyCode <em>magic</em> attribute. This value is the CPython magic number (the one explained above)., the old default value was the value from CPython 2.4 (62021). Some checks against this value are made through the code to decide if the bytecode should be interpreted one way or another. One example is the IMPORT_NAME opcode. In Python 2.4 IMPORT_NAME did not have the level parameter, this parameter is new in 2.5 because of the <em>absolute import</em> feature. So if the bytecode represented by a PyCode object is 2.4, when we visit a <em>import</em> statement we should not try to pop the level value from the stack (because it&#8217;s not there), but if it is 2.5 we should! So we check the magic value. The problem is, the default value was 2.4 but we changed the opcodes to behave like 2.5, so those checks were not working. The solution was to change the magic default value to 63231 (2.5c2 value I think), so now our bytecode interpreter is (almost?) compatible with 2.5 bytecode. And our compiler is generating 2.5 compatible bytecode as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brunogola.com.br/2008/07/pypy-25-features-yet-another-status-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Code Jam: Qualification Round</title>
		<link>http://blog.brunogola.com.br/2008/07/google-code-jam-qualification-round/</link>
		<comments>http://blog.brunogola.com.br/2008/07/google-code-jam-qualification-round/#comments</comments>
		<pubDate>Fri, 18 Jul 2008 02:38:02 +0000</pubDate>
		<dc:creator>Bruno Gola</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[gcj]]></category>

		<guid isPermaLink="false">http://blog.brunogola.com.br/?p=43</guid>
		<description><![CDATA[Most of you probably know that yesterday started the Qualification Round for the Google Code Jam competition. In 24 hours there were 3 problems to be solved using you preferred method (or language). To go to the Round 1 the coder just needed to achieve 25 points. For each problem there were two kinds of [...]]]></description>
			<content:encoded><![CDATA[<p>Most of you probably know that yesterday started the Qualification Round for the <a href="http://code.google.com/codejam">Google Code Jam</a> competition. In 24 hours there were 3 problems to be solved using you preferred method (or language).</p>
<p>To go to the Round 1 the coder just needed to achieve 25 points. For each problem there were two kinds of input, a Small and a Large one, the correct answer for the small input counts 5 points and the correct answer for the large input counts 20 points, so the only way to go to Round 1 was solving at least one problem for both inputs. I did it for problems <strong>A</strong> and <strong>B</strong>. Of course I&#8217;ve solved them using <strong>Python</strong> <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> </p>
<p><strong>Problems.</strong></p>
<p>The first problem was to minimize the number of switches a central engine should make between multiple search engines. You receive a list of search engine names and a list of query, each query is the name of a search engine. The search engine shouldn&#8217;t search for itself or the universe will &#8220;implode&#8221; (or something like that <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ).  Well, the basic way to solve this is to always switch to the last next engine in the queries list. </p>
<p>The second problem was to optimize the number of trains that should be in station A and in station B at the start of the day. This given the time that each train leave A and reaches B (and vice-versa). My solution here was to create a list of coming trains (actually of time that the train would be prepared to leave) for each station and then popping out them when a train that should the station leaves after one came (so you reuse the train).</p>
<p>Well, that&#8217;s it. Now let&#8217;s get ready for Round 1 <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brunogola.com.br/2008/07/google-code-jam-qualification-round/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PyPy 2.5-features &#8211; PyParser, Grammar and PEPs</title>
		<link>http://blog.brunogola.com.br/2008/07/pypy-25-features-pyparser-grammar-and-peps/</link>
		<comments>http://blog.brunogola.com.br/2008/07/pypy-25-features-pyparser-grammar-and-peps/#comments</comments>
		<pubDate>Mon, 07 Jul 2008 16:08:13 +0000</pubDate>
		<dc:creator>Bruno Gola</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[pypy]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[peps]]></category>

		<guid isPermaLink="false">http://blog.brunogola.com.br/?p=41</guid>
		<description><![CDATA[After two weeks without any writing, here comes another status update of my GSoC (and I promise I&#8217;ll do it more frequently). Today I&#8217;m working on PEP 342 &#8211; &#8220;Coroutines via Enhanced Generators&#8221;. I&#8217;ve finished to implement the .send() method and all the stuff it should do &#8220;behind the scenes&#8221; (e.g. push the value into [...]]]></description>
			<content:encoded><![CDATA[<p>After two weeks without any writing, here comes another status update of my GSoC (and I promise I&#8217;ll do it more frequently).</p>
<p>Today I&#8217;m working on PEP 342 &#8211; &#8220;Coroutines via Enhanced Generators&#8221;. I&#8217;ve finished to implement the <em>.send()</em> method and all the stuff it should do &#8220;behind the scenes&#8221; (e.g. push the value into the frame stack).</p>
<p>Last week some other PEPs and small changes were supported as well. </p>
<p>PEPs 308 (conditional expressions) and 343 (with statement) were already supported, I just needed to write tests and remove a SyntaxWarning for conditional expressions. PEP 352 (BaseException and raise &#8220;string&#8221;) is now supported as well.</p>
<p>Some changes were made to Grammar2.5 because pyparser could not read it the right way. Those changes were already present to Grammar2.4. The main problem is that when the parser finds a rule that has alternatives (like, &#8216;is&#8217; | &#8216;is&#8217; &#8216;not&#8217; ) and the first alternative matches (imagine it trying to match &#8216;is not&#8217;, it will match &#8216;is&#8217;) it doesn&#8217;t look for the other alternatives and then fails (because there is no rule that matches a &#8216;not&#8217; after an &#8216;is&#8217;). The solution in that case is to change the order (which doesn&#8217;t make much sense, before looking the parser&#8217;s code), so the rule should be &#8216;is&#8217; &#8216;not&#8217; | &#8216;is&#8217;.</p>
<p>Next steps: check PyCode magic number and finish PEP 342 <img src='http://blog.brunogola.com.br/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.brunogola.com.br/2008/07/pypy-25-features-pyparser-grammar-and-peps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
