Guido van Rossum wrote: > There are doubts about its usefulness. (AKA YAGNI.) Would you also > provide implementations for common object types? Otherwise there > wouldn't be a point, right? Thomas Heller wrote: > If you call YAGNI, it's ok for me, that's why I'm asking. Better save > the time in this case... This might be a YAGNI, since everyone can get by with there own private strategy, but it's still a good idea. Right now I have code that makes very specific checks on what type of PyObject is passed in to a function to see whether it is "safe enough" to release the GIL. For instance, the current implementation of strings seems to be safe enough for this, but most other buffer types aren't. This is a bummer since arrays aren't really "safe enough", and that's the kind of data we (people at my company) usually want to pass to a C extension. Right now I tell them they have to do an array.tostring() call first. That's ugly because it makes a copy of a potentially huge chunk of memory. It would be much better if an object could promise not to realloc or free your pointer after the GIL is released by implementing this interface. Martin v. Löwis wrote: > This is flawed. According to the PEP, an object which has > acquirelockedbuffer called will live forever: > > # Retrieving a buffer from an object puts this object in a locked > # state during which the buffer may not be freed, resized, or > # reallocated. The wording may not be specific enough, but the idea is that you can lock a buffer object and should (must) unlock it later. Between the lock and unlock, you are promised that your pointer won't be reallocated. You could release the GIL so other threads can run concurrently on multi processor hardware. You could pass the pointer to an asynchronous I/O routine. All sorts of good stuff. Martin v. Löwis wrote: > If it is just the interface, I'm -1. You don't need a PEP to define an > interface in Python - just establish an interface in the types you > care about. There are several types I care about which are out of my control: string, array, mmap, Numeric.array. If it not getting into 2.3 implies that Thomas Heller doesn't want to work on it, could you guys put it in the "abandoned" category instead of "rejected" or "retracted". It really is a good idea. __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4