[Tutor] A couple newbie questions about Python

Deb Wyatt codemonkey at inbox.com
Thu Jun 12 04:47:49 CEST 2014


Thanks very much Alan.  As for the my concern about inaccuracy in float math, I suppose I am concerned because I was not aware of the issue before, and I wonder how you deal with such things when you need accuracy for financial things.

Deb in WA, USA


> -----Original Message-----
> From: alan.gauld at btinternet.com
> Sent: Wed, 11 Jun 2014 23:48:37 +0100
> To: tutor at python.org
> Subject: Re: [Tutor] A couple newbie questions about Python
> 
> On 11/06/14 21:46, Deb Wyatt wrote:
>> Hi.  Everywhere I have read, the 'standard practice' for indentation is
>> 4 spaces,
> 
> That's a style recommendation. Python doesn't care.
> But your readers will. 2 spaces is the absolute minimum,
> 8 spaces is about the absolute maximum. Outside that it
> gets hard to read the code.
> 
> 3, 4 or 5 spaces is pretty good and you are unlikely
> to get complaints except from style pedants or if you
> are submitting code for the standard library where they
> like to stick with the official guidance.
> 
> 
>> I just recently became aware of the inaccuracy of calculations using
>> floats
>  > and I am concerned about that.
> 
> The inaccuracies are an inevitable result of the way your computer
> processes floating point numbers.
> 
> In what way are you concerned? Its not a Python issue - the exact same
> issues occur in any computer - or even your pocket calculator.
> If it concerns you in Excel or in Visual Basic/Java/C++ etc too then the
> good news is that Python has alternative renderings that can often
> reduce/eliminate them - but at the cost of speed and complexity.
> 
> 
> HTH
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.flickr.com/photos/alangauldphotos
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor

____________________________________________________________
Protect your computer files with professional cloud backup.
Get PCRx Backup and upload unlimited files automatically. 
Learn more at http://backup.pcrx.com/mail




More information about the Tutor mailing list