[Python-ideas] Formatting mini-language suggestion

Lie Ryan lie.1296 at gmail.com
Thu Mar 12 08:47:12 CET 2009

Stephen J. Turnbull wrote:
> Raymond Hettinger writes:
>  > Will start with Nick's simple proposal as a starting point.
>  > 
>  > [Nick Coghlan]
>  > >  [[fill]align][sign][#][0][minimumwidth][,][.precision][type]

could maximumwidth be possible? It's useful if we rather break the 
display of the numbers than breaking the display of the table (and 
possibly add a special sign if width overflow occur, like <62432)

> +1 for making that the stopping point, too.
> I can't speak for the Chinese, but the Japanese also use the Chinese
> numbering system where the verbal expression of large numbers is
> grouped by 10000s.  However, in tables of government expenditure and
> the like, the commas usually occur every three places.  Eg, the
> official GDP figures from the Japanese Ministry of Economy and Trade:
> http://www.mext.go.jp/b_menu/toukei/001/08030520/013.htm

Should there should be a convenience function that will help construct 
the format string. Some kind of: create_format(self, type='i', base=16, 
seppos=4, sep=':', charset='0123456789abcdef', maxwidth=32, minwidth=32, 

(cookies for you if you noticed that it is ipv6 number format)

More information about the Python-ideas mailing list