Sturla Molden brought up a point in an earlier thread ("Please help with
subclassing numpy.ndarray") that I think is worth highlighting. A "common"
approach to subclassing ndarray in python (http://www.scipy.org/Subclasses)
results in code that is not thread safe. This approach involves setting
I have run into an interesting issue with multiarraymodule.c with
regards to embedding Python in a C application on Windows XP. In the
application, the following abbreviated sequence was executed
1) Py_Initialize
2) numpy is imported
3) Py_Finalize
4) Py_Initialize
5) attempt to import nump
The behavior below seems strange to me. The string array is type S3
yet it says that comparison with 'abc' is not implemented. The ==
operator seems to work though. Is there a subtlty I am missing or is
it simply a bug?
In [1]: import numpy
In [2]: numpy.equal(numpy.array(['abc', 'def']), 'a
Of course !
Now I remember why I didn't test it yet...
Thanks,
-Sebastian
On 2/6/07, Robert Kern <[EMAIL PROTECTED]> wrote:
> Sebastian Haase wrote:
> > Hi,
> > I finally tried to do the test, to memmap a large file
> > filesize: 2.8G
> >
> > a memmap call gives this error:
> >
> > {{{
> N.m
Sebastian Haase wrote:
> Hi,
> I finally tried to do the test, to memmap a large file
> filesize: 2.8G
>
> a memmap call gives this error:
>
> {{{
N.memmap('20050622-1648-Y_DEMO-1')
> Traceback (most recent call last):
> File "", line 1, in ?
> File "/jws30/haase/PrLinN64/numpy/core/memm
Hi,
I finally tried to do the test, to memmap a large file
filesize: 2.8G
a memmap call gives this error:
{{{
>>> N.memmap('20050622-1648-Y_DEMO-1')
Traceback (most recent call last):
File "", line 1, in ?
File "/jws30/haase/PrLinN64/numpy/core/memmap.py", line 67, in __new__
mm = mmap.mm
On 2/6/07, Paulo J. S. Silva <[EMAIL PROTECTED]> wrote:
> Em Dom, 2007-02-04 às 17:28 -0800, Keith Goodman escreveu:
>
> > Could numpy.matlib get the same functions as numpy? Would that have to
> > be done with a manually maintained import list?
> > I always use "import numpy.matlib as M" and then
> I don't pretend to know all the inner workings of subclassing, but I
> don't think that would work, given the following output:
> In [6]: x+y
> This is where __array_finalize__ is called
> Out[6]: MyArray([4, 5, 6])
Why is not __new__ called for the return value of x + y? Does it call
__new__
> Yes using __init__ to set an instance attribute is the Pythonic way to
> do this. However, I calculate/create the data in __new__. The data
> is unavailable to __init__.
The signatures of __new__ and __init__ is:
def __new__(cls, *args, **kwds)
def __init__(self, *args, **kwds)
If __new__ h
On 2/6/07, Sturla Molden <[EMAIL PROTECTED]> wrote:
>
> > def __new__(cls,...)
> > ...
> > (H, edges) = numpy.histogramdd(..)
> > cls.__defaultedges = edges
> >
> > def __array_finalize__(self, obj):
> > if not hasattr(self, 'edges'):
> > self.edges = self.__defaultedges
>
On Tue, Feb 06, 2007 at 01:06:37PM +0100, Sturla Molden wrote:
>
> > def __new__(cls,...)
> > ...
> > (H, edges) = numpy.histogramdd(..)
> > cls.__defaultedges = edges
> >
> > def __array_finalize__(self, obj):
> > if not hasattr(self, 'edges'):
> > self.edges = self.__de
> def __new__(cls,...)
> ...
> (H, edges) = numpy.histogramdd(..)
> cls.__defaultedges = edges
>
> def __array_finalize__(self, obj):
> if not hasattr(self, 'edges'):
> self.edges = self.__defaultedges
So in order to get an instance attribute, one has to temporarily defi
Em Dom, 2007-02-04 às 17:28 -0800, Keith Goodman escreveu:
> Could numpy.matlib get the same functions as numpy? Would that have to
> be done with a manually maintained import list?
> I always use "import numpy.matlib as M" and then search for function
> names in ipython (M.a[TAB]). I didn't reali
13 matches
Mail list logo