<?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>Python Blog - All about python</title>
	<atom:link href="http://www.python-blog.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.python-blog.com</link>
	<description>and technologies around</description>
	<lastBuildDate>Mon, 01 Mar 2010 20:29:08 +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>Documenting project using Sphinx</title>
		<link>http://www.python-blog.com/2010/02/21/documenting-project-using-sphinx/</link>
		<comments>http://www.python-blog.com/2010/02/21/documenting-project-using-sphinx/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 17:10:15 +0000</pubDate>
		<dc:creator>Łukasz Balcerzak</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[documentation sphinx]]></category>
		<category><![CDATA[sphinx]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.python-blog.com/?p=257</guid>
		<description><![CDATA[We have no time for creating documentation for our project&#8230; wrong! Documentation and tests are crucial in all software projects. Sure, it is more important that our software would work fine but package of unit tests almost always save time (in future as less bugs are produced) and without documentation shouldn&#8217;t be treated as &#8220;user [...]]]></description>
			<content:encoded><![CDATA[<p>We have no time for creating documentation for our project&#8230; wrong! Documentation and tests are crucial in all software projects. Sure, it is more important that our software would work fine but package of unit tests almost always save time (in future as less bugs are produced) and without documentation shouldn&#8217;t be treated as &#8220;user guide&#8221;.</p>
<p>It doesn&#8217;t matter if you are creating project for your company or you plan to release it as an open source &#8211; by providing documentation you make life easier for other contributors and end-users, of course. And if you know how to write <a href="http://docutils.sourceforge.net/rst.html">restructuredText</a> documents then you already own necessary skills to create documentation lighting fast!</p>
<h2>Prepare!</h2>
<p>First of all, you would need to have <a href="http://docutils.sourceforge.net/rst.html">Distutils</a> and <a href="http://sphinx.pocoo.org/">Sphinx</a> installed. You can install it using one of the Python package management tools, in example <i>easy_install</i> would do the job. I prefer to use <a href="http://pypi.python.org/pypi/pip">pip</a>:</p>
<pre class="brush:bash">
pip install distutils
pip install sphinx
</pre>
<p>Simply use any project you&#8217;d like to create documentation for, I would use <a href="http://bitbucket.org/lukaszb/django-richtemplates/">django-richtemplates</a>. Create a new directory for your documentation and run <i>sphinx-quickstart</i> command:</p>
<pre class="brush:bash">
hg clone https://bitbucket.org/lukaszb/django-richtemplates/ django-richtemplates-temp
cd django-richtemplates-temp
sphinx-quickstart
</pre>
<p>Just answer some questions &#8211; they are very straightforward. You should probably turn <i>autodoc</i> option on.<br />
Sphinx would create some directories for internal usage and static content storage (<i>_build</i>, <i>_static</i> and <i>_templates</i>), configuration file (<i>conf.py</i>) and index file (<i>index.html</i>). Ok, enough of this crap, lets create our first documentation page! </p>
<h2>First page</h2>
<p>Create new file, lets call it <i>installation.rst</i> and write the document itself:</p>
<pre class="brush:plain">
.. _installation:

============
Installation
============

Fake installation for `django-richtemplates`_ project.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur.

.. note::
   Yeah, this would be a note.
   Very simple, indeed.

Some more crap
--------------

If you would like to highlight a code snippet, it is as easy as::

   from mycompany.auth import AuthenticationBackend

   class MyClass(object):
       """
       Docstring.
       """
       def __init__(self, *args, **kwargs):
           """
           Some *business* logic.
           """
           pass
       def authenticate(self, username, password):
           """
           External authentication process.
           """
           auth = AuthenticationBackend(username, password)
           return auth.is_authenticated()

Or choose language explicit:

.. code-block:: bash

   cd django-richtemplates
   sudo python setup.py install

Yeah, `restructuredText <http://docutils.sourceforge.net/rst.html>`_ is great!
And easy, too.

External-internal hyperlinks
----------------------------

You may also use ``sphinx`` features, like linking to other *documents*, like
this: go to :ref:`configuration`.

.. _django-richtemplates: http://bitbucket.org/lukaszb/django-richtemplates/
</pre>
<p>This is standard restructured text document. The only sphinx specific parts are first line (need to add relation with file itself &#8211; this is needed for table of contents generation) and reference to other file (which is done with <i>ref:`configuration`</i>). Yup, we haven&#8217;t created <i>configuration.rst</i> file, yet. So do this now, and paste following:</p>
<pre class="brush:plain">
.. _configuration:

=========================
Configuring richtemplates
=========================

I hope you have already read chapter :ref:`installation`.

Lorem ipsum!
------------

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur.
</pre>
<h2>Don&#8217;t forget about the main page!</h2>
<p>I once hoped that the first page (namely <i>index.rst</i>) is generated automatically, yet, I was wrong. But in order<br />
to supply needed data for sphinx generator you have to make very simple changes to the <i>index.rst</i>. Just add<br />
<i>:glob:</i> option to the <i>toctree</i> directive. Finally, mark that all (<i>*</i>) restructuredText documents should<br />
be used.</p>
<pre class="brush:plain">
.. django-richtemplates documentation master file, created by
   sphinx-quickstart on Sat Feb 20 21:42:53 2010.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to django-richtemplates's documentation!
================================================

Contents:

.. toctree::
   :maxdepth: 2
   :glob:

   *

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
</pre>
<p>Now in <i>mydocs</i> directory run</p>
<pre class="brush:bash">
make html
</pre>
<p>and open file located at <i>mydocs/_build/html/index.html</i>. You should see your documentation!</p>
<h2>Final words</h2>
<p>Ok, this was very simple and the effect is &#8211; for such a little work done &#8211; quite amazing if you&#8217;d ask me.<br />
However, we still haven&#8217;t used <i>autodoc</i> Sphinx&#8217;s extension. Let&#8217;s do that now &#8211; create new file<br />
<i>api.rst</i> and paste whats below:</p>
<pre class="brush:plain">
.. _api:

===
API
===

You can find some basic API information here.

Forms API
---------

In this section we cover some basics about the `django-richtemplates`'s forms
API.

.. automodule:: richtemplates.forms
   :members:

.. _django-richtemplates: http://bitbucket.org/lukaszb/django-richtemplates/
</pre>
<p>Again, run make command and see your documentation. Ok, so where is your API, you ask? Well, if you look at the output<br />
of <i>make html</i> command you&#8217;d see that there was a warning &#8211; <i>richtemplates.forms</i> couldn&#8217;t be found.<br />
Which is completely correct, as Sphinx doesn&#8217;t try to guess where your modules are, you have to configure it by yourself.<br />
Change <i>sys.path</i> by uncommenting existing line and change it to this:</p>
<pre class="brush:python">
sys.path.append(os.path.abspath('..'))
</pre>
<p>If you are not sure why why put <i>..</i> there, it&#8217;s simple &#8211; Sphinx would go a one directory up (<i>..</i>) and try to find <i>richtemplates</i> there. Try to build your documentation now. Warning again? Yeah, Sphinx now complains about not<br />
having <i>DJANGO_SETTINGS_MODULE</i> which is, again, totally correct. As importing <i>richtemplates</i> won&#8217;t<br />
raise exception, but trying to get deeper into the module (<i>richtemplates.forms</i>) would be impossible without<br />
being within Django context (same would happen if you try to run python interpreter and run <i>from django import forms</i>).<br />
So add this line into your <i>conf.py</i> file:</p>
<pre class="brush:python">
os.environ['DJANGO_SETTINGS_MODULE'] = 'django.conf.global_settings'
</pre>
<p>More information about <i>autodoc</i> extension could be found <a href="http://sphinx.pocoo.org/ext/autodoc.html">here</a>.</p>
<p>Hope this would help anyone trying to start with his/her own documentation :)<br />
If you have any suggestions &#8211; let me know.</p>
<p>Take care and make documentation, not war.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.python-blog.com/2010/02/21/documenting-project-using-sphinx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pydev alternative</title>
		<link>http://www.python-blog.com/2010/02/10/pydev-alternative/</link>
		<comments>http://www.python-blog.com/2010/02/10/pydev-alternative/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 09:10:21 +0000</pubDate>
		<dc:creator>Marcin Kuźmiński</dc:creator>
				<category><![CDATA[Editors]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[intellij]]></category>
		<category><![CDATA[jetbrains]]></category>
		<category><![CDATA[pycharm]]></category>
		<category><![CDATA[PyDev]]></category>
		<category><![CDATA[rubycharm]]></category>

		<guid isPermaLink="false">http://www.python-blog.com/?p=246</guid>
		<description><![CDATA[makers of a great ruby on rails IDE rubymine, and ever greater Java IDE intelliJ, released
another  (probably) great idea product named pycham, a python IDE, written from scratch in Java.
Since IntelliJ is a really the best Java IDE out there, i presume their next product
dedicated to python will be worth switching.
It&#8217;s still in preview [...]]]></description>
			<content:encoded><![CDATA[<p>makers of a great ruby on rails IDE rubymine, and ever greater Java IDE intelliJ, released<br />
another  (probably) great idea product named pycham, a python IDE, written from scratch in Java.</p>
<p>Since IntelliJ is a really the best Java IDE out there, i presume their next product<br />
dedicated to python will be worth switching.</p>
<p>It&#8217;s still in preview but as for now it provides:</p>
<ul>
<li>Coding Assistance</li>
<li>Project Code Navigation</li>
<li>Google App Engine Support</li>
<li>Code Analysis</li>
<li>Python Refactoring</li>
<li>Web Development with Django (some really nice ones)</li>
<li>debugger</li>
<li>Integrated unit tests</li>
<li>Version control integration</li>
</ul>
<p><a href="http://jetbrains.com"><br />
<img class="alignnone" title="pycharm" src="http://www.jetbrains.com/pycharm/features/screenshots/tour/framed/PC_Hello1.png" alt="" width="325" height="175" /><br />
</a></p>
<p>I&#8217;d tested under linux, seems to be a littler slower than my eclipse home brew version, but I&#8217;d expect the final version faster. It has few nice features, easy configuration, code completion are doing fine.<br />
You can grab a free 45 day copy from <a href="http://www.jetbrains.com/pycharm/index.html" target="_blank">here</a>.</p>
<p>I&#8217;ll for sure fallow this product development. Stay posted for more !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.python-blog.com/2010/02/10/pydev-alternative/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Sqlalchemy model generator on bitbucket</title>
		<link>http://www.python-blog.com/2010/02/09/sqlalchemy-model-generator-on-bitbucket/</link>
		<comments>http://www.python-blog.com/2010/02/09/sqlalchemy-model-generator-on-bitbucket/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 09:00:41 +0000</pubDate>
		<dc:creator>Marcin Kuźmiński</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[SqlAlchemy]]></category>
		<category><![CDATA[bitbucket]]></category>
		<category><![CDATA[model generator]]></category>

		<guid isPermaLink="false">http://www.python-blog.com/?p=244</guid>
		<description><![CDATA[I&#8217;m in a way of releasing few of my projects to bitbucket.
Starting now I&#8217;m releasing the Sqlalchemy model generator. A quick reminder, it&#8217;s a project that you
can generate models based on your database. So you don&#8217;t need to write models by yourself.
You can see the project here: http://bitbucket.org/marcinkuzminski/sqlalchemy_model_generator/
Any participants are welcome.
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m in a way of releasing few of my projects to bitbucket.<br />
Starting now I&#8217;m releasing the Sqlalchemy model generator. A quick reminder, it&#8217;s a project that you<br />
can generate models based on your database. So you don&#8217;t need to write models by yourself.<br />
You can see the project here: http://bitbucket.org/marcinkuzminski/sqlalchemy_model_generator/<br />
Any participants are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.python-blog.com/2010/02/09/sqlalchemy-model-generator-on-bitbucket/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pylons translating custom error messages.</title>
		<link>http://www.python-blog.com/2010/02/08/pylons-translating-custom-error-messages/</link>
		<comments>http://www.python-blog.com/2010/02/08/pylons-translating-custom-error-messages/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 09:02:53 +0000</pubDate>
		<dc:creator>Marcin Kuźmiński</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[lazy translations]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[Pylons]]></category>
		<category><![CDATA[pylons translation issues]]></category>
		<category><![CDATA[python blog]]></category>
		<category><![CDATA[translation problems]]></category>

		<guid isPermaLink="false">http://www.python-blog.com/?p=148</guid>
		<description><![CDATA[I&#8217;d created another simple application in pylons, final step was to translate it from English to Polish.
I used the babel extractor recommended by pylons and that went really smooth.
My application have a language selector available anytime from menu.
I saw that even this switch worked very well for mako templates and string inside controllers,
 it did [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d created another simple application in pylons, final step was to translate it from English to Polish.</p>
<p>I used the babel extractor recommended by pylons and that went really smooth.</p>
<p>My application have a language selector available anytime from menu.<br />
I saw that even this switch worked very well for mako templates and string inside controllers,<br />
 it did not work when displaying my custom messages that i over rid in validators<br />
and also did not work in my own custom validators that inherit from FancyValidator.<br />
So i started to investigate this.</p>
<p>The first problem of not translating custom error messages in the regular formencode validators was easily being fixed by using lazy_ugettex method.</p>
<pre class="brush:python">
def _(s):
    #fix for translation error messages
    return lazy_ugettext(s)
</pre>
<p>This method allowed me to use lazy_ugettext to translate.<br />
So now when in the validators your translating a string using _(&#8216;this string is for translate&#8217;) method it&#8217;s actually wrapper for lazy_ugettext function.<br />
Lazy translation is when you translate a string when it is accessed, not when the _() or other functions are called.</p>
<p>The second problem of translating custom error messages in your own validator was a bigger problem</p>
<p>I was looking for a solution for some time, and found a nice trick. You have to use your own<br />
state_obj with static _() function. As example below for custom validation function.</p>
<pre class="brush:python">
class ValidLoginNames(formencode.validators.FancyValidator):

    messages = {'invalid_name':_('you cannot use %(username)s as login')}

    def validate_python(self, value, state):
        banned_names = ['admin', 'administrator', 'root']
        if value in banned_names:
            raise formencode.Invalid(self.message('invalid_name', state = State_obj, username = value), value, state)

#this is needed to translate the messages using _()
class State_obj(object):
    _ = staticmethod(_)
</pre>
<p>Those two trick now let&#8217;s you translate custom validators without a problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.python-blog.com/2010/02/08/pylons-translating-custom-error-messages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mail problems&#8230;</title>
		<link>http://www.python-blog.com/2010/02/07/mail-problems/</link>
		<comments>http://www.python-blog.com/2010/02/07/mail-problems/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 21:21:23 +0000</pubDate>
		<dc:creator>Marcin Kuźmiński</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.python-blog.com/?p=242</guid>
		<description><![CDATA[So again the blog was having some mail problems which I just fixed.
So anyone can register, post to the blog again.
Sorry for the problems.
]]></description>
			<content:encoded><![CDATA[<p>So again the blog was having some mail problems which I just fixed.<br />
So anyone can register, post to the blog again.</p>
<p>Sorry for the problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.python-blog.com/2010/02/07/mail-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stackless python and python C Extensions</title>
		<link>http://www.python-blog.com/2010/02/07/stackless-python-and-python-c-extensions/</link>
		<comments>http://www.python-blog.com/2010/02/07/stackless-python-and-python-c-extensions/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 19:34:36 +0000</pubDate>
		<dc:creator>Marcin Kuźmiński</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[montreal python]]></category>
		<category><![CDATA[stackless python]]></category>
		<category><![CDATA[videos]]></category>

		<guid isPermaLink="false">http://www.python-blog.com/?p=235</guid>
		<description><![CDATA[I was browsing a web for some videos about stackless python implementation.
And i found a Montreal Python blip tv channel. montreal python blip tv
They have few interesting podcast which i recommend everyone to watch. The two last ones,
are dedicated to Stackless python and C extensions. Those are montreal python #8 and #9.
Be sure to check [...]]]></description>
			<content:encoded><![CDATA[<p>I was browsing a web for some videos about stackless python implementation.<br />
And i found a Montreal Python blip tv channel. <a href="http://montrealpython.blip.tv/">montreal python blip tv</a><br />
They have few interesting podcast which i recommend everyone to watch. The two last ones,<br />
are dedicated to Stackless python and C extensions. Those are montreal python #8 and #9.</p>
<p>Be sure to check them out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.python-blog.com/2010/02/07/stackless-python-and-python-c-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Efficient reading a huge file in python</title>
		<link>http://www.python-blog.com/2010/01/02/efficient-reading-a-huge-file-in-python/</link>
		<comments>http://www.python-blog.com/2010/01/02/efficient-reading-a-huge-file-in-python/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 11:36:23 +0000</pubDate>
		<dc:creator>Marcin Kuźmiński</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.python-blog.com/?p=225</guid>
		<description><![CDATA[Reading a huge file (ie. 70gb) in python just using open() could get you in troubles :).
There is a clean and nice solution for reading a complex huge files or list.
Using the new with open() as  statement and python generator function you could write an easy functions
which will read such files without taking whole [...]]]></description>
			<content:encoded><![CDATA[<p>Reading a huge file (ie. 70gb) in python just using open() could get you in troubles :).<br />
There is a clean and nice solution for reading a complex huge files or list.<br />
Using the new with open() as  statement and python generator function you could write an easy functions<br />
which will read such files without taking whole computer resources. Each iteration on such a function will perform a read of<br />
given size, and the with statement will make sure that file is closed when iteration is finished&#8230;</p>
<p>An example of such a function:</p>
<pre class="brush:python">
def read_large_file(filename, mode = 'rs', size = '1024'):
    '''
    A lazy generator functions that reads a file with a given chunk of data
    USAGE:
    for data_chunk in read_large_file('/tmp/huge.file','rb',10240):
        print data_chunk
    @param filename: a filename
    @param mode: read mode
    @param size: size to read at one iteration
    '''
    with open(filename, mode) as f:
        while 1:
            data = f.read(size)
            if not data:
                break
            yield data
</pre>
<p>Remember that with statement is supported out of the box from python 2.6 in python<br />
2.5 you have to do</p>
<pre class="brush:python">
from __future__ import with_statement
</pre>
<p>before using it. If you have troubles using with statement i recommend reading<br />
<a href="http://effbot.org/zone/python-with-statement.htm">this link</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.python-blog.com/2010/01/02/efficient-reading-a-huge-file-in-python/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>alternate &#8220;preaty&#8221; print method.</title>
		<link>http://www.python-blog.com/2010/01/01/alternate-preaty-print-method/</link>
		<comments>http://www.python-blog.com/2010/01/01/alternate-preaty-print-method/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 20:47:29 +0000</pubDate>
		<dc:creator>Marcin Kuźmiński</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[alternate print]]></category>
		<category><![CDATA[debug printing for collections]]></category>
		<category><![CDATA[pprint]]></category>

		<guid isPermaLink="false">http://www.python-blog.com/?p=220</guid>
		<description><![CDATA[I always loved how the print_r() function worked in php. In python print does print everything but when large collections (ie huge dicts) are printed using print  you could get lost in the output. I just discovered a little smarter print function called pprint from module pprint

from pprint import pprint

This is great for debugging [...]]]></description>
			<content:encoded><![CDATA[<p>I always loved how the print_r() function worked in php. In python print does print everything but when large collections (ie huge dicts) are printed using print  you could get lost in the output. I just discovered a little smarter print function called pprint from module pprint</p>
<pre class="brush:python">
from pprint import pprint
</pre>
<p>This is great for debugging something in collections. Pprint prints in a nicer human readable form types of data like : list,dict,tuples.</p>
<pre class="brush:python">
l = [x for x in range(100)]
l.insert(0, l[:])
pprint(l)
l = dict([(x, x) for x in range(100)])

pprint(l)
#this will print this list in more convinient way
{0: 0,
 1: 1,
 2: 2,
 3: 3,
 4: 4,
 5: 5,
 6: 6,
 7: 7,
 8: 8,
 9: 9,
 ...
 98: 98,
 99: 99}
</pre>
<p>There are two interesting arguments in pprint function the:<br />
        width<br />
            Attempted maximum number of columns in the output.<br />
       width=100 will wrap everything that outputs longer than 100 chars.<br />
and<br />
        depth<br />
            The maximum depth to print out nested structures.<br />
ie:</p>
<pre class="brush:python">
pprint.pprint(stuff, depth=3)
['aaaaaaaaaa',
 ('spam', ('eggs', (...))),
 ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'],
 ['cccccccccccccccccccc', 'dddddddddddddddddddd']]
#now as you can see the tuples at index 1 have a depth of more than 3 and #they are being reduced by the pprint. Imagine how this helps with debuggin a
#really complicated structures.
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.python-blog.com/2010/01/01/alternate-preaty-print-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pydev 1.5.1 &#8211; still getting better.</title>
		<link>http://www.python-blog.com/2009/11/20/pydev-1-5-1-still-getting-better/</link>
		<comments>http://www.python-blog.com/2009/11/20/pydev-1-5-1-still-getting-better/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 23:02:41 +0000</pubDate>
		<dc:creator>Marcin Kuźmiński</dc:creator>
				<category><![CDATA[Editors]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[1.5.1]]></category>
		<category><![CDATA[decorators]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[eclipse plugin]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[PyDev]]></category>
		<category><![CDATA[pydev 1.5]]></category>

		<guid isPermaLink="false">http://www.python-blog.com/?p=214</guid>
		<description><![CDATA[Few days ago there was again a major update on pydev eclipse plugin.
The version 1.5.1. Comes with new refactoring engine PEPTIC, it&#8217;s way better than any one before.
Complete list below: visit http://pydev.org for download.

Release 1.5.1

Improvements in the AST rewriter
Improvements on the refactoring engine:

No longer using BRM
Merged with the latest PEPTIC
Inline local available
Extract method bug-fixes
Extract local [...]]]></description>
			<content:encoded><![CDATA[<p>Few days ago there was again a major update on pydev eclipse plugin.<br />
The version 1.5.1. Comes with new refactoring engine PEPTIC, it&#8217;s way better than any one before.<br />
Complete list below: visit <a href="http://pydev.org" target="_blank">http://pydev.org</a> for download.</p>
<div id="release-1-5-1">
<h1>Release 1.5.1</h1>
<ul>
<li>Improvements in the AST rewriter</li>
<li>Improvements on the refactoring engine:
<ul>
<li>No longer using BRM</li>
<li>Merged with the latest PEPTIC</li>
<li>Inline local available</li>
<li>Extract method bug-fixes</li>
<li>Extract local on multi-line</li>
<li>Generating properties using coding style defined in preferences</li>
<li>Add after current method option added to extract method</li>
<li>A bunch of other corner-case situations were fixed</li>
</ul>
</li>
<li>Bug-fixes:
<ul>
<li>Minor editor improvements</li>
<li>Adding default forced builtins on all platforms (e.g.: time, math, etc) which wouldn&#8217;t be on sys.builtin_module_names on some python installations</li>
<li>Adding &#8216;numpy&#8217; and &#8216;Image&#8217; to the forced builtins always</li>
<li>Ctrl+1: Generate docstring minor fixes</li>
<li>Ctrl+1: Assign to local now follows coding style preferences properly</li>
<li>Exponential with uppercase E working on code-formatting</li>
<li>When a set/get method is found in code-completion for a java class an NPE is no longer thrown</li>
<li>Backspace properly treated in block mode</li>
<li>Setting IRONPYTHONPATH when dealing with Iron Python (projects could not be referenced)</li>
<li>No longer giving spurious &#8217;statement has no effect&#8217; inside of lambda and decorators</li>
<li>Fixed new exec in python 3k</li>
<li>Fixed NPE when breakpoint is related to a resource in a removed project</li>
<li>Fixed import problem on regexp that could lead to a recursion.</li>
<li>No longer giving NPE when debugging with the register view open</li>
<li>List access be treated as __getitem__() in the list &#8212; patch from Tassilo Barth</li>
<li>Fix for invalid auto-self added when typing</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.python-blog.com/2009/11/20/pydev-1-5-1-still-getting-better/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Eclipse button issue on ubuntu 9.10</title>
		<link>http://www.python-blog.com/2009/11/15/eclipse-button-issue-on-ubuntu-9-10/</link>
		<comments>http://www.python-blog.com/2009/11/15/eclipse-button-issue-on-ubuntu-9-10/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 20:05:54 +0000</pubDate>
		<dc:creator>Marcin Kuźmiński</dc:creator>
				<category><![CDATA[Editors]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[buttons]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[issue]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[python blog]]></category>
		<category><![CDATA[ubuntu 9.10]]></category>

		<guid isPermaLink="false">http://www.python-blog.com/?p=210</guid>
		<description><![CDATA[I installed new eclipse on ubuntu 9.10, and noticed that manu of FINISH,
NEXT buttons are not working correctly ( you can&#8217;t click them).
So it found out it&#8217;s eclipse bug, but fortunately there is a simple
solution to this problem.
Write a startup script:
#!/bin/sh
export GDK_NATIVE_WINDOWS=1
/path_to_eclipse/eclipse
Save it as eclipse-run.sh make it +x, and the buttons will work now if [...]]]></description>
			<content:encoded><![CDATA[<p>I installed new eclipse on ubuntu 9.10, and noticed that manu of FINISH,<br />
NEXT buttons are not working correctly ( you can&#8217;t click them).</p>
<p>So it found out it&#8217;s eclipse bug, but fortunately there is a simple<br />
solution to this problem.</p>
<p>Write a startup script:</p>
<pre>#!/bin/sh
export GDK_NATIVE_WINDOWS=1
/path_to_eclipse/eclipse</pre>
<p>Save it as eclipse-run.sh make it +x, and the buttons will work now if you<br />
run your eclipse via the run script.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.python-blog.com/2009/11/15/eclipse-button-issue-on-ubuntu-9-10/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
