[IPython-dev] Column format

Robert Kern robert.kern at gmail.com
Tue Apr 5 11:31:50 EDT 2011


On 4/5/11 2:25 AM, Hans Meine wrote:
> Am Montag, 4. April 2011, um 22:58:35 schrieb Robert Kern:
>> On 4/4/11 12:04 PM, Hugo Gagnon wrote:
>>> Hello,
>>>
>>> Is there a function in the ipython API that takes in a list of strings
>>> to output and returns a nicely formatted list of lines depending on the
>>> terminal's width? If so where is it located so I'll probably need to
>>> modify it since I don't really have a terminal as is but rather a GUI
>>> application...
>>
>> https://bitbucket.org/robertkern/kernmagic/src/tip/kernmagic/utils.py#cl-92
>
> Is there a good reason for this:
>    isinstance(strings[i], str)
> I would have expected sth. more like:
>    isinstance(strings[i], basestring)
> (which would lead to unicode being returned if the input contained unicode
> strings).
>
> Nice util function otherwise,

I took the function from cmd.py, which uses str. I don't think anything bad 
would happen if you used basestring and passed unicode strings.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the IPython-dev mailing list