lists <-> tuple

2005-11-02 Thread Peter Notebaert
I am new to Python and have to create an import library in C that uses 
matrices.

These matrices can be one-dimensional (vectors) or two-dimensional. If I 
look in the ActivePython 2.4 documentation at data structures, then I see at 
least 2 posibilities to represent them: Lists and Tuples.

The documention doesn't give me much information on what the best choice is 
for the data type to provide/return these matrices.

So my question is, should I use lists or tuples to represent my matrices in 
and why?

Thanks for any reaction. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to compile c-extensions under WinXP?

2005-11-05 Thread Peter Notebaert

<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> What should I do to be able to compile C-extensions (with python 2.4,
> winXP)? I get an error message, approximately "The .NET Framework SDK
> needs to be installed"; I tried to get something from the Microsoft web
> site, but maybe not the right version (or didn't set some variables),
> since the error remains. Could you please help me (it will need some
> patience with a computer newbie)?
>

You need the Microsoft .NET Visual Studio environment. A stripped and free 
version is available at http://msdn.microsoft.com/visualc/vctoolkit2003/
However I am not sure if everything will work with this stripped version.

Peter 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: lists <-> tuple

2005-11-05 Thread Peter Notebaert

"Jim" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>> Tuples or lists for matrix-like functionality?
>
> Use lists.  Tuples are meant for small immutable sets of things that go
> together.  Lists are more like arrays, and you can assign to one
> existing element if you want.
>
> One exception, is a short vector is often a tuple like (x, y, z) and
> you might want to multiply that vector by your matrix.  You can convert
> a tuple to a list with   list(aTuple)  or back with  tuple(aList.)
>
> Even better, take a look at numarray (or numpy or scipy or scipy_core.)
> They all have really nice matrix code and there are C APIs that let
> you manipulate them.  Chances are they do everything you're intending
> to implement.
>
> Immutability example:
> tup = ("a", "b", "c")
> tup[1] = "g"
> Traceback (most recent call last):
>  File "", line 1, in ?
> TypeError: object does not support item assignment
> lst = ["a", "b", "c"]
> lst[1] = "g"
> lst
> ['a', 'g', 'c']
>
>
> -Jim
>

Thanks! 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: lists <-> tuple

2005-11-05 Thread Peter Notebaert

"Robert Kern" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Peter Notebaert wrote:
>> I am new to Python and have to create an import library in C that uses
>> matrices.
>>
>> These matrices can be one-dimensional (vectors) or two-dimensional. If I
>> look in the ActivePython 2.4 documentation at data structures, then I see 
>> at
>> least 2 posibilities to represent them: Lists and Tuples.
>>
>> The documention doesn't give me much information on what the best choice 
>> is
>> for the data type to provide/return these matrices.
>>
>> So my question is, should I use lists or tuples to represent my matrices 
>> in
>> and why?
>
> You'll probably want to use scipy_core. It's a package designed
> specifically to deal with multidimensional arrays of homogeneous,
> (usually) numeric data.
>
>  http://numeric.scipy.org
>
> -- 
> Robert Kern
> [EMAIL PROTECTED]
>
> "In the fields of hell where the grass grows high
> Are the graves of dreams allowed to die."
>  -- Richard Harter
>

Thanks! 


-- 
http://mail.python.org/mailman/listinfo/python-list


Python driver for lpsolve

2005-11-16 Thread Peter Notebaert
 lp_solve is a Mixed Integer Linear Programming (MILP) solver (see 
http://lpsolve.sourceforge.net/5.5/).

There is now a Python driver to lpsolve. See 
http://lpsolve.sourceforge.net/5.5/Python.htm for more information about 
this driver.

Peter 


-- 
http://mail.python.org/mailman/listinfo/python-list