Re: [Tutor] Need a better name for this function

2009-12-16 Thread Richard D. Moores
On Wed, Dec 16, 2009 at 20:23, Dave Angel wrote: > Richard D. Moores wrote: > There are conceivably better ways to get at the mantissa of the fp number, > but you can simply parse the hex digits as I did manually, and add one and > subtract one from the given mantissa  (the part between the decim

Re: [Tutor] Need a better name for this function

2009-12-16 Thread Dave Angel
Richard D. Moores wrote: On Wed, Dec 16, 2009 at 14:48, Richard D. Moores wrote: I just realized that my question was absurd, in that given real numbers n and x there is no x such that both x < n and x is greater than all other numbers less than n. So after inserting "(in 14 hex digits)" at 2

Re: [Tutor] Need a better name for this function

2009-12-16 Thread Richard D. Moores
On Wed, Dec 16, 2009 at 14:48, Richard D. Moores wrote: I just realized that my question was absurd, in that given real numbers n and x there is no x such that both x < n and x is greater than all other numbers less than n. So after inserting "(in 14 hex digits)" at 2 places, my question is: Ho

Re: [Tutor] Need a better name for this function

2009-12-16 Thread Richard D. Moores
On Wed, Dec 16, 2009 at 02:48, Dave Angel wrote: > Richard D. Moores wrote: > If you really want to see what binary fp does, you might need to resort to > hex.  Two methods of float are relevant, hex() and fromhex().  Check out the > following function I just wrote. > > import decimal > float2dec

Re: [Tutor] another unit-testing question: regex testing

2009-12-16 Thread Serdar Tumgoren
> I found existing test libs to be difficult to adapt to text > matching/parsing/processing tasks. So I ended up writing my own testing > utilities. But the context is different: it's for a custom matching library, > with pattern objects for which testing tools are methods. Anyway, someone may

Re: [Tutor] faster substring replacement

2009-12-16 Thread Dave Angel
R. Alan Monroe wrote: I'm wondering whether text.replace has to shove oodles of text to the right in memory when you replace a shorter word with a longer word. Someone else on the list may know. Alan Since a string is immutable, replace() has to copy the string. So it doesn't need to

Re: [Tutor] Need a better name for this function

2009-12-16 Thread Dave Angel
Richard D. Moores wrote: On Tue, Dec 15, 2009 at 23:30, Hugo Arts wrote: On Wed, Dec 16, 2009 at 5:12 AM, Richard D. Moores wrote: Before I can go below I need to know if you are saying that the relevant doc is wrong. I took the original name for my function almost directly from it. N

Re: [Tutor] Need a better name for this function

2009-12-16 Thread spir
Hugo Arts dixit: > The function will give you the exact value of any > floating point number stored in memory. To be even clearer: Seems you messed up "the exact value of any floating point number stored in memory" with "an accurate value (= the intended value)". _

Re: [Tutor] another unit-testing question: regex testing

2009-12-16 Thread spir
Serdar Tumgoren dixit: > > I often use a list of test cases to drive a single test. Using a > > series of tests is just too painful compared to making a simple list > > of test cases. > > I kinda suspected that but wasn't sure. These tests are for a REALLY > basic regex and I was having nightmar

Re: [Tutor] Need a better name for this function

2009-12-16 Thread Richard D. Moores
On Tue, Dec 15, 2009 at 23:30, Hugo Arts wrote: > On Wed, Dec 16, 2009 at 5:12 AM, Richard D. Moores wrote: >> >> Before I can go below I need to know if you are saying that the >> relevant doc is wrong. I took the original name for my function almost >> directly from it. Near the bottom of >>