

TabLib: Pythonic Tabular Data Library - mnemonik
http://thechangelog.com/post/1112527716/tablib-pythonic-tabular-data-library

======
benhoyt
Looks like a nice little module.

However, just some comments on the (lack of) Pythonicity in this function:

    
    
        def is_string(obj):
            """Tests if an object is a string"""
            return True if type(obj).__name__ == 'str' else False
    

First, you don't need the "True if ... else False", because == is already a
boolean operator which returns True or False.

Also, you don't need to look at the type's __name__. You can just say:

    
    
        type(obj) == str
    

But Python already has an isinstance() function which will also work properly
with subclasses of str, so suddenly you don't need the is_string() helper
function anymore, and it becomes:

    
    
        isinstance(obj, str)
    

(Though you should probably use "basestring" in Python 2.x so it works with
Unicode keys too.)

------
zrail
This looks pretty interesting. We have a similar home-grown library at work
with a lot more structure built into the headers. For example, a header can
specify what datatype the column is (number, text, icon), as well as a title
in various formats (html, text, spreadsheet). The basic idea is the same,
though. Take a bunch of data, throw it in a container object, and export it in
a bunch of different formats.

