← Back to team overview

kicad-developers team mailing list archive

Re: Python binding of enums

 

On 8/9/2012 1:45 PM, Dick Hollenbeck wrote:
On 08/09/2012 10:52 AM, Miguel Angel Ajo Pelayo wrote:
You have defined the options we have perfectly clear, now we're at "1",
for most cases shouldn't be a problem. But for some it might be.

Only one point, if you pass a string where an int should be, SWIG will launch
an exception back to python, and python will tell the user. The only
(known) case is  int == enum.

Greetings! :)



Actually you have been exceptionally clear and easy to work with.

I just want Jean-Pierre and Wayne to step in and comment on the
notion of using a "bad argument exception" before it becomes propagated widely.

For those of you who have not work closely with me over the past few years, I will always lean towards keeping the C++ source as clean as possible. After spending way more hours than I care to think about cleaning the KiCad source, I would like to avoid SWIG specific code creeping into to C++ source as much as possible. That being said, I also believe that scripting capability is extremely important to KiCad so I am not opposed to it if there is not a better solution. I just don't think we have exhausted all of the possibilities yet. It's been a long time (8+ years) since I've written any SWIG code. I seem to remember having to do a lot of hand tweaking to get the results I wanted as opposed to the include everything method. The include everything method is obviously the easiest way to go but as others have pointed out it has it's own set of issues. My preference is to keep as much of this as we can in the SWIG binding code.

Wayne


Some costs are obviously worth the benefit.  That decision however, needs to be made
consciously and with all the data and alternatives in hand.

I will now rest my case, the yellow light has flashed.


Thanks,

Dick


_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp




References