[Pyrex] [Mac Inter Core Duo OS 10.4.9 ] Next question: cmd line build of init

David Goldsmith David.L.Goldsmith at noaa.gov
Wed Jun 6 16:52:53 UTC 2007


Francesc Altet wrote:
> [Please always reply to the list so that other people and help/learn
> to/from you]
>   
Sorry, I thought I did (I usually do) but I guess I forgot to this time. :-)
> The problem is that you have defined GetNumVertices() as 'cdef' function
> instead of 'def'.  'cdef' is the way to declare C functions but these
> will not be callable from Python. Try this:
>   
What if I want it to be callable from both?

DG
> def GetNumVertices():
>     if test_vals.nodes:
>         return test_vals.d.getNrows()
>
> better.
>
>   
>> I haven't yet tried to write a setup.py because, in trying to 
>> debug/understand the problem myself, I messed w/ the Setup.py in the 
>> Demos - stupidly forgetting to back-up the original first - and now that 
>> doesn't "work" either, producing stuff which also causes the same 
>> ImportError, so I'm not sure what to do vis-a-vis writing a successful 
>> setup.py, and reinstalling Pyrex is too big of a distraction at this 
>> point unless absolutely necessary.
>>     
>
> Installing Pyrex is pretty simple. When you will be more used to install
> larger Python packages (for ex. PyTables or, still better, SciPy) you
> will see what I mean ;)
>
>   
>> As an aside (perhaps; perhaps it's on point) in the Demos, exactly what 
>> is the function of the pyprimes.py file (which seems to more or less 
>> duplicate the primes.pyx file) and why doesn't the spam demo have a 
>> similar "companion"?  Does it have to do with the fact that the spam 
>> demo defines a class with a __new__ method but the primes demo doesn't, 
>> and if so, is this relevant to the "missing init" problem I'm 
>> experiencing?  (I note that I'm not presently defining a class - I tried 
>> that as a soln. to my problem, but it had no effect).
>>     
>
> I guess that pyprimes.py is there just because for speed comparison
> purposes. In the case of spam.pyx the intention was to show how to work
> with classes with Pyrex and the author didn't intend to do a direct
> speed comparison in this case, so this is probably why he didn't added
> the Python equivalent.
>
> Cheers,
>
>   

-- 
ERD/ORR/NOS/NOAA <http://response.restoration.noaa.gov/emergencyresponse/>



More information about the Pyrex mailing list