<br><br><div><span class="gmail_quote">On 1/9/07, <b class="gmail_sendername">Christopher Barker</b> <<a href="mailto:Chris.Barker@noaa.gov">Chris.Barker@noaa.gov</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Timothy Hochberg wrote:<br>> The reason that I ask is that the two projects that I use regularly are<br>> wxPython and PIL generally operate on relatively large data chunks and<br>> it's not clear that they would see much benefit over this mechanism
<br>> versus the array protocol.</blockquote><div><br>Let me preface my remarks by saying, that I was initially assuming that this was meant as a supplement to the earlier array protocol proposal, not a replacement as Travis subsequently explained.
<br> </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">But is this mechanism any harder? </blockquote><div> </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
It doesn't look like it to me. In<br>fact, as I have written a tiny bit of Numeric extension code, this looks<br>  familiar and pretty easy to work with.</blockquote><div><br>I expect that the old proposal is easier to implement 
<span style="font-style: italic;">right now</span>. We could implement the old array protocol in wxPython and have fairly seemless integration with numpy without any dependencies. To implement the new protocol, we'd need the C-API. Since that's not in Python at the moment, we'd have to include implementations of the various functions into wxPython. I suppose that wouldn't really be that bad assuming they are already implemented somewhere. It's a bit of a chicken and the egg problem though.
<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">> I imagine that between us Chris Barker and I could hack together<br>> something for wxPython (not that I've asked him aout it).
<br><br>I'm not sure when I'll find the time, but I do want to do this.<br><br>> And code would<br>> probably go a long way to convincing people what a great idea this is.<br>> However, all else being equal, it'd be a lot easier to do this for the
<br>> array protocol since there's no extra infrastructure involved.<br><br>Is it that much infrastructure?</blockquote><div><br>I'm not sure. It may not be that bad. I'd guess you'd need both an include file and a source file for the implementations of the functions.
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">It looks like this would, at the least, require an extra include file.<br>If this flies , then that will be delivered with python 
2.8?  until then<br>(and for older pythons) would various extension writers all need to add<br>this extra file to their source? And might we get a mess with different<br>versions floating around out there trying to interact?
</blockquote><div><br>Possibly. It shouldn't be a big deal if the API is frozen. But I expect the best thing to get this to work would be to implement this for as many projects as possible as trial patches before trying to get this into those projects officially. That way we can get some experience, tweak the API if necessary, then freeze it and release it officially.
<br><br>Like I said, I'll help with wxPython. I'm tempted to try with PIL as well, but I've never looked at the code there, not even tried to compile it, so I don't know how far I'd get.<br> </div><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">> FWIW, the array protocol PEP seems more relevant to what I do since I'm<br>> not concerned so much with the overhead since I'm sending big chunks of
<br>> data back and forth.<br><br>That's the biggest issue, but I think a lot of us use a lot of small<br>arrays as well -- and while I don't know if it's a performance hit worth<br>worrying about, it's always bugged me that is is faster to convert to a
<br>python list, then pass it in to wxPython than it is to just pass in the<br>array directly.</blockquote><div><br>You should have seen it in the old days before I sped it up. Actually I think you probably did.<br><br>Anyway, it seems like wxPython is low hanging fruit in the sense that we could probably get it done without too much trouble and it would be pretty easy. It's possible that Robin may not accept the patch until the relevant code goes into Python, but just having a patch available would be a useful template for other project and would show the performance gains this approach would lead to. At least I sure hope so.
<br><br>Travis: does the code implementing the C API exist already, or is that something that still needs to be written? <br><br>-tim<br> </div><br></div><br>