Re: [Tutor] Python 2.5.4 - error in rounding

2010-05-22 Thread Steven D'Aprano
On Sun, 23 May 2010 12:19:07 am Wayne Werner wrote: > On Sat, May 22, 2010 at 7:32 AM, Steven D'Aprano wrote: > > Why do people keep recommending Decimal? Decimals suffer from the > > exact same issues as floats, > > This is exactly incorrect! The Decimal operator offers /exact/ > decimal point op

Re: [Tutor] Python 2.5.4 - error in rounding

2010-05-22 Thread Wayne Werner
On Sat, May 22, 2010 at 7:32 AM, Steven D'Aprano wrote: > Why do people keep recommending Decimal? Decimals suffer from the exact > same issues as floats, > This is exactly incorrect! The Decimal operator offers /exact/ decimal point operations. They implement non-hardware operations to preserve

Re: [Tutor] Python 2.5.4 - error in rounding

2010-05-22 Thread Steven D'Aprano
On Sat, 22 May 2010 07:16:20 am wesley chun wrote: > correct, it is a floating point issue regardless of language.. it's > not just Python. you cannot accurately represent repeating fractions > with binary digits (bits). more info specific to Python here: > http://docs.python.org/tutorial/floatingp

Re: [Tutor] Python 2.5.4 - error in rounding

2010-05-22 Thread Steven D'Aprano
On Sat, 22 May 2010 07:51:31 am Alan Gauld wrote: > "Neven Gorsic" wrote > > > I run into Python error in rounding and not know how to predict > > when it will > > occur in order to prevent wrong result. > > It depends how you define wrong. When I was at scvhool the rules f > or rounding decimals

[Tutor] writing csv files

2010-05-22 Thread prasad rao
Thanks I got it. I reached the old PEP document by searching the keyword 'excel' Thanks or the help ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] writing csv files

2010-05-22 Thread Peter Otten
prasad rao wrote: > hello! > > I got a problem writing csv file. > > 1) > csvw=csv.writer(open('/home/prasad/kkm','w'), > dialect='excel',fieldnames=names) > Traceback (most recent call last): > File "", line 1, in > TypeError: 'fieldnames' is an invalid keyword argument for this function >

Re: [Tutor] writing csv files

2010-05-22 Thread Sander Sweers
On 22 May 2010 09:46, prasad rao wrote: >  csvw=csv.writer(open('/home/prasad/kkm','w'), > dialect='excel',fieldnames=names) > Traceback (most recent call last): >  File "", line 1, in > TypeError: 'fieldnames' is an invalid keyword argument for this function fieldnames is part of the dictreader

Re: [Tutor] writing csv files

2010-05-22 Thread Alan Gauld
"prasad rao" wrote I got a problem writing csv file. I can't help with that specifically but... for x in csvr: ...y=lambda x: ''.join([x.split()[3],x.split()[-3],x.split()[-6]]) ...csvw.write(y) lambdas are intended for anonymous functions so if you are not going to pass the la

[Tutor] writing csv files

2010-05-22 Thread prasad rao
hello! I got a problem writing csv file. 1) csvw=csv.writer(open('/home/prasad/kkm','w'), dialect='excel',fieldnames=names) Traceback (most recent call last): File "", line 1, in TypeError: 'fieldnames' is an invalid keyword argument for this function 2) for x in csvr: ...y=lambda x: '