back to list

ratio generating program

🔗graham@...

10/4/2000 7:15:00 AM

In-Reply-To: <200010041304.IAA29253@...>
>
> Bugged, which I assume came about as you tried to make the
> function names more sensible or consistent. I do this all the time.

Specifically as I try to make them shorter:)

> >def isWithinProductLimit(ratio, limit):
> > return reduce(lambda x, y: x*y, ratio, 1L)<=limit
>
> This is called several times as ratioWithinProductLimit...

Okay, change from ratioWithin... to isWithin... everywhere. You can also
replace that function with

def isWithinProductLimit(ratio, limit):
try:
return reduce(lambda x, y: x*y, ratio)<=limit
except OverflowError:
return 0

which should do the same thing where limit isn't long, but faster.

> You might find my strange little python JI library
> useful... or not :) http://www.execpc.com/~wsannis/ratio.html.
> I've recently been making changes to that library to do more analytic
> things, partially in response to the H.E. discussions. May I include
> this code (probably classed or otherwise shoved into its own
> namespace) in future versions? At any rate, the library improves as
> my understanding does.

I downloaded it earlier in the year, and thought "WTF is katapyknosis?".
Yes, you can add my functions. A class would be a good idea: what with
everything using the same product limit. I'll e-mail you direct once I've
had a look at the new file, as this is getting OT.

Graham