prePEP: Money data type

Batista, Facundo FBatista at uniFON.com.ar
Tue Oct 21 13:49:02 EDT 2003


Alex Martelli wrote:

#- > thousandSeparator = '.'
#- > decimalSeparator = '.'
#- > 
#- > the behaviour is unpredictable (should I generate an exception or
#- > something?)
#- 
#- Yes (in face of ambiguity refuse the temptation to guess).

Added to PEP.


#- So, if a $ is pasted in front I need to go to the trouble
#- of taking it out anyway, etc.
#- 
#- A 'format' method could take optional arguments specifying which
#- locale to use, whether to use money or basic conventions,
#- international or basic ones, etc.  THAT would be of some use,
#- of course.  A __str__ method cannot take such arguments,
#- and IMHO should therefore default to simplicity -- just
#- '12.34' (so I can use a '$%8s' % m to get the kind of format
#- shown in the above columnar output).

OK. See your point and agree with it.

But .format should be very complicated (accepting different arguments, etc,
etc) or should be very simple (use '$' and '.', and if you want it
different, overload it)?






More information about the Python-list mailing list