Re: Newbie question about lists

2005-07-20 Thread Robert Kern
Paul Rubin wrote: > "Leo Jay" <[EMAIL PROTECTED]> writes: > >>[Decimal("0.25"), Decimal("0.10"), Decimal("0.05"), Decimal("0.01")] > > I wonder if we should have some special syntax for decimals: maybe > > [$.25, $.10, $.05, $.01] > > That would even fit in with decimals being used for financi

Re: Newbie question about lists

2005-07-20 Thread Leo Jay
IMO, python should use the decimal for default. .25 is right for Decimal(".25"). isn't that better? -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question about lists

2005-07-20 Thread Paul Rubin
"Leo Jay" <[EMAIL PROTECTED]> writes: > [Decimal("0.25"), Decimal("0.10"), Decimal("0.05"), Decimal("0.01")] I wonder if we should have some special syntax for decimals: maybe [$.25, $.10, $.05, $.01] That would even fit in with decimals being used for financial quantities. -- http://mail.pyth

Re: Newbie question about lists

2005-07-20 Thread Leo Jay
you may use the decimal module which was introduced in Python2.4 >>> from decimal import * >>> li = [Decimal(".25"), Decimal(".10"), Decimal(".05"), Decimal(".01")] >>> print li [Decimal("0.25"), Decimal("0.10"), Decimal("0.05"), Decimal("0.01")] >>> -- http://mail.python.org/mailman/listinfo/p

Re: Newbie question about lists

2005-07-20 Thread Austin
Well, that answers that. Thank you! -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question about lists

2005-07-20 Thread Robert Kern
Austin Cox wrote: > Hello, I just started with python and have run into a problem using > lists. > > If I enter: > li = [.25,.10,.05,.01] > and then enter: > print li > it'll output: > [0.25, 0.10001, 0.050003, 0.01] > > Can anyone tell me why it does this, and