Re: mantissa and exponent in base 10

2010-10-08 Thread C or L Smith
Jason Swails wrote: >> s = ('%%%ig' % sigfigs) % n # double-% cancels the % Thanks! I see that the parenthesis can be dropped, too: >>> '%%.%ig' % 3 % 4.23456e-5 '4.23e-05' /c -- http://mail.python.org/mailman/listinfo/python-list

Re: mantissa and exponent in base 10

2010-10-07 Thread C or L Smith
I just sent a similar suggestion to tutor: check out the %g format. >>> print '%g' % 1.2345e7 1.2345e+07 >>> print '%g' % 1.2345e-7 1.2345e-07 >>> print '%g' % 1.2345 1.2345 >>> def me(n, sigfigs = 4): ... s = ('%.'+'%ig' % sigfigs) % n # check docs for a better way? ... if 'e' in s: m, e = s.s

Re: where is ctrl+newline handled in pywin editor?

2009-09-23 Thread C or L Smith
{Sorry about the no-wrap in the first post...} I use the pywin environment on Windows for python code editing and interactive environment. I've been able to find the place in the editor files where the enter key is handled and where the whitespace is stripped from a line and I've been able

where is ctrl+newline handled in pywin editor?

2009-09-21 Thread C or L Smith
I use the pywin environment on Windows for python code editing and interactive environment. I've been able to find the place in the editor files where the enter key is handled and where the whitespace is stripped from a line and I've been able to get it to not leave any white space when a doub

PyWin editor modification

2009-09-12 Thread C or L Smith
The PyWin editor that comes with the Windows distribution is a great little workhorse. If you have used it you perhaps notice how it intelligently works with spaces and indentation, e.g. after typing the word 'pass' and pressing enter it dedents one level as you would probably desire. It also st

Re: Parsing text

2009-05-06 Thread C or L Smith
> Hi, > I'm trying to write a fairly basic text parser to split up scenes and > acts in plays to put them into XML. I've managed to get the text split > into the blocks of scenes and acts and returned correctly but I'm > trying to refine this and get the relevant scene number when the split > is ma

Re: Modifying the value of a float-like object

2009-04-24 Thread C or L Smith
I happened across the recent discussion and found it very interesting as I have been dusting off and trying to get ready a module that I had made that created a number class that handled numeric values and uncertainties in computations by computing (via overloaded operators) a new value and unce