Re: [Python-Dev] Issue 643841: Including a new-style proxy base class in 2.6/3.0

2008-05-28 Thread Michael Foord
Greg Ewing wrote: Nick Coghlan wrote: else: # Returned a different object, make a new proxy result = type(self)(result) You might want to check that the result has the same type as the proxied object before doing that. Yep - and I really think it would need to do this. T

Re: [Python-Dev] Issue 643841: Including a new-style proxy base class in 2.6/3.0

2008-05-27 Thread Greg Ewing
Nick Coghlan wrote: else: # Returned a different object, make a new proxy result = type(self)(result) You might want to check that the result has the same type as the proxied object before doing that. -- Greg ___ Python-Dev maili

Re: [Python-Dev] Issue 643841: Including a new-style proxy base class in 2.6/3.0

2008-05-27 Thread Greg Ewing
Armin Ronacher wrote: I'm currently not providing any __r*__ methods as I was too lazy to test on each call if the method that is proxied is providing an __rsomething__ or not, and if not come up with an ad-hoc implementation by calling __something__ and reversing the arguments passed. I don't

Re: [Python-Dev] Issue 643841: Including a new-style proxy base class in 2.6/3.0

2008-05-22 Thread Nick Coghlan
Fred Drake wrote: On May 21, 2008, at 5:41 AM, Nick Coghlan wrote: While a proxy class written in C would no doubt be faster than one written in Python, one of the things I'm hoping to achieve is for the stdlib generic proxy to serve as an example for people writing their own new-style proxy c

Re: [Python-Dev] Issue 643841: Including a new-style proxy base class in 2.6/3.0

2008-05-21 Thread Nick Coghlan
Fred Drake wrote: On May 21, 2008, at 5:41 AM, Nick Coghlan wrote: While a proxy class written in C would no doubt be faster than one written in Python, one of the things I'm hoping to achieve is for the stdlib generic proxy to serve as an example for people writing their own new-style proxy c

Re: [Python-Dev] Issue 643841: Including a new-style proxy base class in 2.6/3.0

2008-05-21 Thread Fred Drake
On May 21, 2008, at 5:41 AM, Nick Coghlan wrote: While a proxy class written in C would no doubt be faster than one written in Python, one of the things I'm hoping to achieve is for the stdlib generic proxy to serve as an example for people writing their own new-style proxy classes in additi

Re: [Python-Dev] Issue 643841: Including a new-style proxy base class in 2.6/3.0

2008-05-21 Thread Nick Coghlan
Fred Drake wrote: Nick Coghlan wrote: So what do people think of including a ProxyBase implementation in 2.6 and 3.0 that explicitly delegates all of the C-level slots to a designated target instance? On May 20, 2008, at 7:55 PM, Greg Ewing wrote: Sounds good to me. Same here. There's an

Re: [Python-Dev] Issue 643841: Including a new-style proxy base class in 2.6/3.0

2008-05-20 Thread Fred Drake
Nick Coghlan wrote: So what do people think of including a ProxyBase implementation in 2.6 and 3.0 that explicitly delegates all of the C-level slots to a designated target instance? On May 20, 2008, at 7:55 PM, Greg Ewing wrote: Sounds good to me. Same here. There's an implementation i

Re: [Python-Dev] Issue 643841: Including a new-style proxy base class in 2.6/3.0

2008-05-20 Thread Greg Ewing
Nick Coghlan wrote: So what do people think of including a ProxyBase implementation in 2.6 and 3.0 that explicitly delegates all of the C-level slots to a designated target instance? Sounds good to me. -- Greg ___ Python-Dev mailing list Python-Dev@

Re: [Python-Dev] Issue 643841: Including a new-style proxy base class in 2.6/3.0

2008-05-20 Thread Michael Foord
Nick Coghlan wrote: One of the tasks where classic classes are currently far superior to new-style classes is in writing proxy classes like weakref.proxy - cases where nearly all operations need to be delegated to some other object, with only a few being handled via the proxy type object itself

[Python-Dev] Issue 643841: Including a new-style proxy base class in 2.6/3.0

2008-05-20 Thread Nick Coghlan
One of the tasks where classic classes are currently far superior to new-style classes is in writing proxy classes like weakref.proxy - cases where nearly all operations need to be delegated to some other object, with only a few being handled via the proxy type object itself. With classic clas