Hello,

I'm +1 on preserving python semantics wherever possible.  In my field
(statistics), many people don't have formal training in anything but
R.  I grew up programming in C, so keeping all these issues in mind
isn't hard for me, but trying to teach people small relevant
smatterings of C while showing them how to cythonize some python code
can be a pain.  It can also convey the idea that there are dozens of
other corner cases to keep in mind, and that fear can be kinda
discouraging.  If we say that writing 'cdef int' is a request for c
semantics, and that is the way you have to view it to write correct
code, then the implication is that you have to know C to understand
Cython.    That puts an extra barrier in front of programmers that
don't know C, and there are probably a lot more people in that camp
than most of us realize. My understanding of the philosophy of cython
is that it is trying to be as semantically python-like as possible (at
least that's how it's been presented), and I don't really want that to
change.

Also, adding type information to code when cythonizing it shouldn't
change the behavior of the code in subtle ways (as has been argued).
Departing from python semantics with cython code is implicitly saying
that the proper workflow is just to write in cython first instead of
first writing python code and converting it to cython.

I kinda like the idea of having two types that are only really
different in corner cases like these, e.g. cint , clong, (maybe int,
long), and that these are an explicit request for c semantics in every
way. Other types like int (maybe py_int?) are a request for python
sematics, even if it means a slight speed penalty over c semantics.
Making this distinction explicit would seem to make everyone happy --
both the python coders who want speed and the c coders who work in
python -- though it would probably mean more work for the cython
developers.  It also seems like more of a long-term solution, as there
are other cases this would resolve (like overflows in c but not
python).

--Hoyt

++++++++++++++++++++++++++++++++++++++++++++++++
+ Hoyt Koepke
+ University of Washington Department of Statistics
+ http://www.stat.washington.edu/~hoytak/
+ [email protected]
++++++++++++++++++++++++++++++++++++++++++
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to