Hi Dave,
Valid question. However, there are no hidden variables used in format.
Each time you invoke the format method (it's a method of str), it starts
from scratch using only its current arguments. i can't think of any
sense in which 'default' fits here, either.
Thanks, that's somewhat of a relief. In nfaces.py which outputs like
this
<SNIP>
point vertex_11_22_27 0.482610585141 0.963539328269 -0.1161816686
point vertex_11_18_28 0.894075981233 0.461195737945 0.403417680839
face face_0 vertex_0_2_29
face face_0 vertex_0_25_29
face face_0 vertex_0_15_25
face face_0 vertex_0_7_15
face face_0 vertex_0_7_12
face face_0 vertex_0_2_12
normal face_0 -0.396087591388 -0.781284022758 0.482400140683
face face_1 vertex_1_15_30
<SNIP>
there are nested outfile.write commands with logical tests! Best now
I try your suggestions - experiment, I can't break it(!), and if after a
sleepless night, it's all pea soup, I'll log back in with this
marvellous group of very knowledgeable and helpful folks!
You do really need to study the format spec, to see what other
parameters may be more useful. What I supplied is great if all the
digits are to the right of the decimal.
Agreed.
Note, you can also use format on integers, in order to make a fixed
number of columns, for example. Or to get leading zeroes. Or whatever.
Interesting...
And realize that the format does not have to be "inside" the write. So
you can format to a string, then post-process in some way, before
sending to the write method.
Very interesting!
Incidentally, One of numpy or gmpy is probably a very good idea for
you. But as I have no experience with either, it just didn't occur to
me. So I'm glad Peter mentioned one of them. The only catch I know of
is it's an external dependency, meaning you have to download and install
it into the Python search path.
Yes! A while back, Ramit mentioned;
"P.S. If you want large amount of accuracy with number crunching, you
may want to look into using fixed-precision or binary math libraries.
Try looking at scipy/numpy or using Decimal instead of floating-point
numbers. (This is just a suggestion and may be incorrect because I
have not yet needed such accuracy. )"
Which I just searched for and dug up!
Right, I'm off to bash this script like a beginner, and see what
emerges! :) Thanks for so many insights in one night - terrific!
Wish I'd picked this language up *years* ago - it's so foreign to
me now, yet so beautifully useful!
Cheers, John.
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor