Hi Dave,
Not silly at all.  I didn't realize str(float) would truncate to 12
digits either.  I found out by experimenting (with 2.7) in the interpreter.
Very gracious of you to say, and generous of you to trouble yourself
to experiment - thank you very much!
Note that it may differ from version to version.  And that's another
reason to use format.
Excellent point!
But please don't just take the format string I supplied as "right."  It
is if you always want 15 decimal digits to the right of the decimal
point.  But if you have a number like 50 thousand, then many of those
digits to the right are invalid.
Indeed! As you saw, some outputs are, and really must be output as integers. A 1 with a decimal point followed by 15 0's would make a real mess of the face/vertex designation table. So I have to be careful where I invoke
output.write("{0:.15f}".format(x))
or similar, ie, that it operates only on the values I'd like output
that way.
Which raises a question. Is the command 'persistent'? In other words,
if I use it early on, but then wish to output integers, has it 'died
after use', do I need to 'kill it after use', or will python just
default back to what it sees next? I know this sounds silly, but to me
the command 'looks' like it's setting a 'hidden pyton variable' to
"15f" which may need to be explicitly revoked, or not,...???
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to