I wanted to talk about this at the last espresso meeting, but unfortunately I was away doing my PhD exam.
I thought maybe I'd highlight some of my thoughts about what I saw in the python interface that we can discuss over email before the next coding day and perhaps briefly at the next coding day.
I implemented an iterator/generator function that allows the user to do something like:
for p in S.part:
bla bla bla
However, I haven't yet pushed the changes because I don't feel that it really does what we would ideally like it to do.
Issue 1) It's possible to create a particle handle without creating a physical particle in the system. Since S.part is a (somewhat) a list of particle handles, this is troublesome because in the iterator you loop through a list of particle handles rather than particles. Therefore, if you request a property from the particle handle and the particle does not exist, an exception is thrown.
I personally don't see this as desirable behaviour, but I want to hear arguments for and against.
My suggestion is to change the constructor of the ParticleHandle class such that it must accept the relevant parameters in order to successfully initialise a particle. Interesting to hear your thoughts on this.
Issue 2) The potential over-use of Cython.
In my opinion, one of the big attractions of using Python as the espresso interface is the increased readability and simplicity of python code. Cython significantly reduces this readability and simplicity, IMO. However, it seems that everything is written in Cython by default without regard for whether it actually speeds up the code significantly. Ideally we should be writing everything in native python and only cythonising the performance bottlenecks.
Is there a reason that everything is by default cython and not native python? Perhaps I have misunderstood something fundamental to the python interface here.
That's about all I can remember for now.
Interested to hear your opinions on the above 2 issues.
Best wishes, Gary