Re: all possible matchings of elements of two lists

2009-08-26 Thread Mark Dickinson
On Aug 26, 11:05 am, Sandy wrote: > Hi all, > I basically want all possible matchings of elements from two lists, > Ex: [1,2] [a,b,c] > > Required: >    [ [(1,a),(2,b)] >      [(1,b),(2,c)] >      [(1,c),(2,b)] >      [(1,b),(2,a)] >      [(1,c),(2,a)] >      [(1,a),(2,c)] >    ] If you're using

Re: Python on Crays

2009-08-27 Thread Mark Dickinson
On Aug 25, 11:34 pm, Carrie Farberow wrote: > Ok, here are links to word documents outlining the commands I executed as > well as the make.log file and the make_install.log file > [links snipped] So from the output of make, it looks as though none of the modules specified in the Modules/Setup fi

Re: Is behavior of += intentional for int?

2009-08-30 Thread Mark Dickinson
On Aug 29, 8:03 pm, Steven D'Aprano wrote: > On Sat, 29 Aug 2009 11:11:43 -0700, zaur wrote: > > I thought that int as object will stay the same object after += but with > > another integer value. My intuition said me that int object which > > represent integer value should behave this way. > > If

Re: Python3: hex() on arbitrary classes

2009-09-01 Thread Mark Dickinson
On Sep 1, 4:22 pm, Philipp Hagemeister wrote: > class X(object): >     def __int__(self): return 42 >     def __hex__(self): return '2b' #sic > > hex(X()) > > What would you expect? Python2 returns '2b', but python 3(74624) throws > TypeError: 'X' object cannot be interpreted as an integer. Why do

Re: Python3: hex() on arbitrary classes

2009-09-02 Thread Mark Dickinson
On Sep 1, 5:31 pm, Philipp Hagemeister wrote: > Mark Dickinson wrote: > > (...) If you want to be > > able to interpret instances of X as integers in the various Python > > contexts that expect integers (e.g., hex(), but also things like list > > indexing), you sho

Re: Simple addition to random module - Student's t

2009-09-02 Thread Mark Dickinson
On Sep 2, 2:51 pm, Thomas Philips wrote: > While the random module allows one to generate randome numbers with a > variety of distributions, some useful distributions are omitted - the > Student's t being among them. This distribution is easily derived from > the normal distribution and the chi-sq

Re: Simple addition to random module - Student's t

2009-09-02 Thread Mark Dickinson
On Sep 2, 2:51 pm, Thomas Philips wrote: > def student_t(df):         # df is the number of degrees of freedom >     if df < 2  or int(df) != df: >        raise ValueError, 'student_tvariate: df must be a integer > 1' By the way, why do you exclude the possibility df=1 here? -- Mark -- http://m

Re: Simple addition to random module - Student's t

2009-09-02 Thread Mark Dickinson
On Sep 2, 6:15 pm, Thomas Philips wrote: > I mis-spoke - the variance is infinite when df=2 (the variance is df/ > (df-2), Yes: the variance is infinite both for df=2 and df=1, and Student's t with df=1 doesn't even have an expectation. I don't see why this would stop you from generating meanin

Re: Smallest float different from 0.0?

2009-09-07 Thread Mark Dickinson
On Sep 7, 3:47 pm, kj wrote: > Is there some standardized way (e.g. some "official" module of such > limit constants) to get the smallest positive float that Python > will regard as distinct from 0.0? > > TIA! > > kj There's sys.float_info.min: >>> import sys >>> sys.float_info sys.float_info(ma

Re: Smallest float different from 0.0?

2009-09-07 Thread Mark Dickinson
On Sep 7, 5:08 pm, kj wrote: > Hmmm.  This close-to-the-metal IEEE stuff make a "HERE BE DRAGONS!" > alarms go off in my head...  (What's up with that correction by 1 > to sys.float_info.mant_dig?  Or, probably equivalently, why would > sys.float_info.min_exp (-1021) be off by 1 relative to log2 o

Re: Module for Fisher's exact test?

2009-09-07 Thread Mark Dickinson
On Sep 7, 3:50 am, gb345 wrote: > Before I roll my own, is there a good Python module for computing > the Fisher's exact test stastics on 2 x 2 contingency tables? Not in the standard library, certainly. Have you tried SciPy and RPy? -- Mark -- http://mail.python.org/mailman/listinfo/python-li

Re: python decimals

2009-09-15 Thread Mark Dickinson
On Sep 15, 2:27 am, Andrew Svetlov wrote: > Is there some kind of python binding for decNumber library? > Standard decimal.Decimal is good enough, but very slow. > My current project toughly coupled with 'currency' operations and we > have performance problems related to decimal calculations. > Fr

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-15 Thread Mark Dickinson
On Sep 14, 4:05 pm, Scott David Daniels wrote: > Steven D'Aprano wrote: > > On Sun, 13 Sep 2009 17:58:14 -0500, Robert Kern wrote: > > Exactly -- there are 2**53 distinct floats on most IEEE systems, the vast > > majority of which might as well be "random". What's the point of caching > > numbers

Re: python decimals

2009-09-16 Thread Mark Dickinson
On Sep 16, 1:35 am, Andrew Svetlov wrote: > It only reflects the fact what comp.lang.python replicated by several > web sites. > Unfortunately looks like there are no link to library implements that : > ( A few random thoughts: If you just want fixed-precision decimal, there may be simpler solut

<    1   2   3   4   5