Re: [Python-3000] Binding builtin function to class

2008-04-28 Thread Greg Ewing
Alex Martelli wrote: Is this a SWIG-specific issue (so that SWIG can take care of it in the C code it generates or links) or sufficiently general to warrant an addition to the Python core? I haven't been following this closely, but if the issue is what I think it is, Pyrex is going to have the

Re: [Python-3000] Binding builtin function to class

2008-04-28 Thread Christian Heimes
Haoyu Bai schrieb: > I know this is not a bug, but however it is an exception in the > language, what Python trying to avoid. > > Since all C function in extension module is treated as builtin function > or method, the problem maybe bigger than it looks like. In the SWIG's > case, it originally us

Re: [Python-3000] Binding builtin function to class

2008-04-28 Thread Alex Martelli
On Mon, Apr 28, 2008 at 4:14 AM, Haoyu Bai <[EMAIL PROTECTED]> wrote: ... > Yes, these are the very problems I encountered. I think the using of > "new.instancemethod" is for speed, because in SWIG's command line, the > "-fastproxy" option enabled it: > > -fastproxy - Use fast proxy mecha

Re: [Python-3000] Binding builtin function to class

2008-04-28 Thread Haoyu Bai
Richard Boulton wrote: Yes, this is what Haoyu was talking about - I suspect he meant "doesn't work" rather than "cannot work", and that's the reason it doesn't work (both in 2.x and 3.0). Thanks Richard for helping me to explain. I'll ask a direct question: what is the recommended replacemen

Re: [Python-3000] Binding builtin function to class

2008-04-28 Thread Haoyu Bai
Terry Reedy wrote: What is it that 'cannot work'? My guess is that you are talking about the fact that instances do not get bound as an argument to the first parameter of a builtin. Yes, this is what I means. Sorry if my words confused you. If *extension* function show a difference, perh

Re: [Python-3000] Binding builtin function to class

2008-04-28 Thread Richard Boulton
Terry Reedy wrote: | But in the case of builtin function, it can't work. What is it that 'cannot work'? My guess is that you are talking about the fact that instances do not get bound as an argument to the first parameter of a builtin. Yes, this is what Haoyu was talking about - I suspect h

Re: [Python-3000] Binding builtin function to class

2008-04-27 Thread Terry Reedy
"Haoyu Bai" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Hello, | | I'm a GSoC student working on SWIG's Python 3 support. When doing | experiment on Python 3's new features, the different behavior between | binding 'function' and 'builtin_function_or_method' confused me. | | As

[Python-3000] Binding builtin function to class

2008-04-27 Thread Haoyu Bai
Hello, I'm a GSoC student working on SWIG's Python 3 support. When doing experiment on Python 3's new features, the different behavior between binding 'function' and 'builtin_function_or_method' confused me. As we know, unbound method is removed in Python 3. To bind a function to a class, we