Re: exposing extension class attributes

Greg Ewing <[email protected]>
Newsgroups gmane.comp.python.pyrex
Message-ID <[email protected]>
Simon Burton wrote:
> Ie. the c attribute has an underscore in front of it, and
> from python the attribute is without underscore.
> 
> As this is likely to drive me moderately crazy (keeping track
> of underscores) I am wondering how other people handle this issue ?

Would calling it "c_foo" make you feel any better?

I'm not sure what could be done to make this any easier,
short of having some magic by which the same name refers
to the C attribute in Pyrex and the Python property in
Python. But you need to be able to refer to the property
in Pyrex as well, so I can't see how that would work.

> A similar problem occurs with methods. I gave up on duplicating every method
> (a cdef version and a python version), and am just using python methods for now.

Cython has a mechanism for making C methods callable from
Python as well as Pyrex, but last I heard, the implementation
is incorrect in the presence of overriding+inheritance, and
the Cython people are unwilling to pay the performance cost
required to make it work properly.

Some version of this may appear in Pyrex eventually, when
I figure out how to implement it correctly. In the meantime,
I'm using "c_" prefixes to keep my Python and C methods
sorted out.

-- 
Greg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.