installing probstat under Windows 2000

Anton Vredegoor anton at vredegoor.doge.nl
Thu Dec 5 10:15:26 EST 2002


On Wed, 04 Dec 2002 17:30:48 -0800, Erik Max Francis <max at alcyone.com>
wrote:

>The long long type is in C99 and was a common extension even outside of
>gcc, but obviously not all compilers have caught up yet.

The extension compiles with gcc. However IMO using C99 datatypes for
programming combinatorics is not taking advantage of Pythons strong
points.

See for example:

Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on
win32
Type "copyright", "credits" or "license" for more information.
IDLE 0.8 -- press F1 for help
>>> import probstat
>>> p=probstat.Permutation(range(33))
>>> p[0]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]
>>> p=probstat.Permutation(range(34))
>>> p[0]
Traceback (most recent call last):
  File "<pyshell#4>", line 1, in ?
    p[0]
IndexError: Permutation Index out of bounds
>>> def indexedperm(index,L):
    m,n = index,len(L)
    res,T = L[:],L[:]
    for i in range(n):
        m,d = divmod(m,n-i)
        res[i] = T.pop(d)
    return res

>>> indexedperm(0,range(42))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41]
>>> 

Regards,
		Anton.

--

Dann mach ich mir nen Schlitz ins Kleid und find es wunderbar.



More information about the Python-list mailing list