Rhodri James wrote:
[snip]
Frankly, I'd much rather fix the locale system and extend
the format syntax to override the default locale.  Perhaps
something like

  financial = Locale(group_sep=",", grouping=[3])
  print("my number is {0:10n:financial}".format(1234567))

It's hard to think of a way of extending "%" format strings
to cope with this that won't look utterly horrid, though!

The problem with your example is that it magically looks for the locale
name "financial" in the current namespace. Perhaps the name should be
registered somewhere like this:

    locale.predefined["financial"] = Locale(group_sep=",", grouping=[3])
    print("my number is {0:10n:financial}".format(1234567))
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to