[Numpy-discussion] Updating cython directory to pxd usage: objections?

Robert Kern robert.kern at gmail.com
Thu Jun 19 20:29:28 EDT 2008


On Thu, Jun 19, 2008 at 19:18, Fernando Perez <fperez.net at gmail.com> wrote:
> On Thu, Jun 19, 2008 at 5:06 PM, Robert Kern <robert.kern at gmail.com> wrote:
>> On Thu, Jun 19, 2008 at 19:02, Stéfan van der Walt <stefan at sun.ac.za> wrote:
>>> 2008/6/19 Fernando Perez <fperez.net at gmail.com>:
>>>>> - import_array().  Can we put it at the bottom of c_numpy.pxd, so that
>>>>> users don't have to import it every time?
>>>>
>>>> Sounds fine to me, but I don't know if there could be a subtle problem
>>>> with pxds used by multiple pyx files.  I'm not comfortable enough with
>>>> cython to answer the question.
>>>
>>> >From what I understand, a .pxd file is loaded only once -- is that
>>> correct?  Either way, I don't think executing import_array more than
>>> once could hurt (or could it -- Robert?).
>>
>> I don't think it would cause bad things to happen. It is slightly
>> suboptimal, but only just.
>
> As long as it doesn't cause problems, then I'd vote for doing it.
> This only happens at module import time, so even if several modules
> using cython call it, it's only when they get imported.  I think the
> API simplification is worth it (minor, but still nice).
>
> I just tested the changes and there seem to be no ill effects.  Should
> I  go ahead and commit it? I'll do it in a single commit with no other
> changes so it's easy to revert should it prove to be a bad idea.

Sure.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco


More information about the NumPy-Discussion mailing list