[IPython-User] Configure number formatter for integers?

Robert Kern robert.kern@gmail....
Thu Mar 22 11:04:51 CDT 2012


On 3/22/12 3:55 PM, Tobias Nöbauer wrote:
> Hi all,
>
> I'm trying to make IPython 0.12 format large integers as '%g', i.e. in
> floating point notation (I end up counting 0's all the time). I've
> tried to configure c.PlainTextFormatter.type_printers and specify a
> callable for the int type that does the job, like so (in
> ipython_config.py):
>
> c.PlainTextFormatter.type_printers = {
> type(1): (lambda x: '%g' % x)
> }
>
> However, ipython tells me that this callable needs to take 3 arguments
> as soon as I try to output an integer. Any clues where I can find docs
> on the callable signature required here? Or am I on the wrong track?
> Any clues?

http://ipython.org/ipython-doc/rel-0.12/api/generated/IPython.core.formatters.html#IPython.core.formatters.PlainTextFormatter

-- 
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-User mailing list