Deb Wyatt <codemon...@inbox.com> Wrote in message: > Hi. Everywhere I have read, the 'standard practice' for indentation is 4 > spaces, but I am running into 2 space indentation in a lot of tutorials and > such. Should I keep with the 4 spaces, or does it even matter, as long as it > is consistent? >
4 spaces is an excellent choice in my opinion, and many other people's. We just tell our editor to turn the tab key into 4 column alignment and pretty much forget about it. The python interpreter doesn't care. But other people's opinions will matter as soon as you share your code, or work on a multi person project. Note that when you're looking at other people's code, you may be seeing it differently than they, chief reason being html (thank you for remembering to post here in text). The other reason you may think they're using 2 is proportional spacing. It should be off for code. > I just recently became aware of the inaccuracy of calculations using floats > and I am concerned about that. > > I learned programming in 1967 with Fortran, and McCracken spent a chapter warning about that same thing. Probably everything he warned about still applies to Python and modern computers. It is impossible to do serious computing for long without running into these issues. But Python has as many ways of avoiding them as any mainstream language. You can use decimal to avoid some types of problems, and fractions to avoid others. And common sense for others. You will need to understand your tools. BTW, calculators and spreadsheets frequently use decimal rather than binary, and I wrote a decimal floating package for a computer in the mid 70's. It didn't even offer binary. -- DaveA _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor