[Numpy-discussion] Numpy on Python3
Charles R Harris
charlesr.harris at gmail.com
Mon Nov 23 01:33:31 EST 2009
On Sun, Nov 22, 2009 at 10:35 PM, Pauli Virtanen <pav at iki.fi> wrote:
> $ mkdir -p $PWD/dist/lib/python3.1/site-packages
> $ python3 setup.py install --prefix=$PWD/dist
> $ cd $PWD/dist/lib/python3.1/site-packages && python3
> Python 3.1.1+ (r311:74480, Oct 11 2009, 20:22:16)
> [GCC 4.4.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import numpy
> XXX: 3K: numpy.random is disabled for now, uses PyString_*
> XXX: 3K: numpy.ma is disabled for now -- some issues
> >>> numpy.array([1., 2, 3, 4])
> array([ 1., 2., 3., 4.])
> >>> _ + 10
> array([ 11., 12., 13., 14.])
> >>> numpy.ones((4,), dtype=complex)/4
> array([ 0.25+0.j, 0.25+0.j, 0.25+0.j, 0.25+0.j])
> >>> numpy.array([object(), object()])
> array([<object object at 0xb7778810>, <object object at 0xb7778d90>],
> Things were fairly straightforward this far, just many tiny changes.
> What's left is then sorting out the bigger problems :)
> This is still far from being complete:
> - Most use of PyString_* needs auditing (note e.g. the b'object' in the
> dtype print above...).
> I simply added convenience wrappers for PyString -> PyBytes,
> but this is not the correct choice at all points.
> - Also, should dtype='S' be Bytes or Unicode? I chose Bytes for now.
Yeah, this needs deciding. I think compatibility with old files requires
Bytes, we can't change file formats and keep compatibility.
BTW, I made some changes for py3k that depend on the macro NPY_PY3K being
defined, but didn't actually define it anywhere. It needs to go in one of
the include files.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion