<br><br><div class="gmail_quote">On Sun, Nov 22, 2009 at 10:35 PM, Pauli Virtanen <span dir="ltr"><<a href="mailto:pav@iki.fi">pav@iki.fi</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<a href="http://github.com/pv/numpy-work/tree/py3k" target="_blank">http://github.com/pv/numpy-work/tree/py3k</a><br>
<br>
$ mkdir -p $PWD/dist/lib/python3.1/site-packages<br>
$ python3 setup.py install --prefix=$PWD/dist<br>
$ cd $PWD/dist/lib/python3.1/site-packages && python3<br>
Python 3.1.1+ (r311:74480, Oct 11 2009, 20:22:16)<br>
[GCC 4.4.1] on linux2<br>
Type "help", "copyright", "credits" or "license" for more information.<br>
>>> import numpy<br>
XXX: 3K: numpy.random is disabled for now, uses PyString_*<br>
XXX: 3K: <a href="http://numpy.ma" target="_blank">numpy.ma</a> is disabled for now -- some issues<br>
>>> numpy.array([1., 2, 3, 4])<br>
array([ 1.,  2.,  3.,  4.])<br>
>>> _ + 10<br>
array([ 11.,  12.,  13.,  14.])<br>
>>> numpy.ones((4,), dtype=complex)/4<br>
array([ 0.25+0.j,  0.25+0.j,  0.25+0.j,  0.25+0.j])<br>
>>> numpy.array([object(), object()])<br>
array([<object object at 0xb7778810>, <object object at 0xb7778d90>],<br>
dtype=b'object')<br>
<br>
    ***<br>
<br>
Things were fairly straightforward this far, just many tiny changes.<br>
What's left is then sorting out the bigger problems :)<br>
<br>
This is still far from being complete:<br>
<br>
- Most use of PyString_* needs auditing (note e.g. the b'object' in the<br>
  dtype print above...).<br>
<br>
  I simply added convenience wrappers for PyString -> PyBytes,<br>
  but this is not the correct choice at all points.<br>
<br>
- Also, should dtype='S' be Bytes or Unicode? I chose Bytes for now.<br>
<br></blockquote><div><br>Yeah, this needs deciding. I think compatibility with old files requires Bytes, we can't change file formats and keep compatibility.<br><br>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.<br>
<br>Chuck <br></div><br></div>