Re: csv.py sucks for Decimal

2010-04-25 Thread John Machin
On Apr 23, 9:23 am, Phlip phlip2...@gmail.com wrote: When I use the CSV library, with QUOTE_NONNUMERIC, and when I pass in a Decimal() object, I must convert it to a string. Why must you? What unwanted effect do you observe when you don't convert it? the search for an alternate CSV module,

Re: csv.py sucks for Decimal

2010-04-23 Thread Phlip
On Apr 22, 5:03 pm, MRAB pyt...@mrabarnett.plus.com wrote: It might be a stupid question, but have you tried passing in the Decimal() object itself? Yep. Nope. Might as well (we ain't working today). But sorry, as usual, for my tone, and thanks all for playing! --

Re: csv.py sucks for Decimal

2010-04-23 Thread Phlip
On Apr 22, 6:15 pm, Jerry Hill malaclyp...@gmail.com wrote: 10,10.0,10.00,10 That's an int, a float, a Decimal and a string, all of which appear to be formatted as I would expect. When you point your finger 'cause your plan fell thru you got three more fingers, pointing back at you! --Dire

Re: csv.py sucks for Decimal

2010-04-22 Thread Robert Kern
On 4/22/10 6:23 PM, Phlip wrote: Pythonistas: This is not a question so much as registering a complaint. When I use the CSV library, with QUOTE_NONNUMERIC, and when I pass in a Decimal() object, I must convert it to a string. _Not_ a float, because that might cause the rounding errors that

Re: csv.py sucks for Decimal

2010-04-22 Thread MRAB
Phlip wrote: Pythonistas: This is not a question so much as registering a complaint. When I use the CSV library, with QUOTE_NONNUMERIC, and when I pass in a Decimal() object, I must convert it to a string. _Not_ a float, because that might cause the rounding errors that Decimal() seeks to

Re: csv.py sucks for Decimal

2010-04-22 Thread Jerry Hill
On Thu, Apr 22, 2010 at 8:03 PM, MRAB pyt...@mrabarnett.plus.com wrote: It might be a stupid question, but have you tried passing in the Decimal() object itself? MRAB's suggestion works for me in python 3.1.2: import csv, io from decimal import Decimal d = Decimal(10.00) o = io.StringIO() w =