[Numpy-discussion] How to test f2py?

Pauli Virtanen pav@iki...
Wed Feb 24 02:54:05 CST 2010


ke, 2010-02-24 kello 17:33 +0900, David Cournapeau kirjoitti:
> On Wed, Feb 24, 2010 at 5:19 PM, Pauli Virtanen <pav@iki.fi> wrote:
> > I don't think the situation is that bad with f2py. I suppose it will
> > be enough to erect unicode vs. Bytes barrier where the file i/o is 
> > done, and let f2py work internally with unicode. Doesn't sound so
> > bad, but I'd have to take a closer look.
> 
> How did you handle name clash in numpy for 2to3? For example, f2py
> uses things like dict quite a lot as argument for functions, and it
> does not look like 2to3 handles this (or does it ?).

I suppose you mean using "dict" as a variable name, and f2py using
types.DictType which is "dict" in Py3? 2to3 does not handle those.

Using builtin names as variable names is bad practice, so when I met
that in SVN, I just changed the variable names to something more sane. 

> Of course, I
> could try a brute force sed script as a pre-processing step, but maybe
> you got a better way of doing this,

The best alternative, imho, is not to use "dict" as a variable name at
all. We should make that change manually in SVN sources, both for Py2
and Py3.

Grepping the f2py source shows that this problem occurs only in
auxfunc.replace, so changing that shouldn't be too much work.

	Pauli




More information about the NumPy-Discussion mailing list