Re: [Python-3000] Bound and unbound methods

2006-08-18 Thread Nick Coghlan
Guido van Rossum wrote: >> Would a possible special method name __methodcall__ be accepted, where >> if it exists on a callable, you can expect to use it as __call__ but >> with the understanding that it accepts as self when called in >> an optimizable form? This would reduce the method call to tw

Re: [Python-3000] Bound and unbound methods

2006-08-16 Thread Guido van Rossum
On 8/15/06, Calvin Spealman <[EMAIL PROTECTED]> wrote: > On 8/16/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > Right. I'm against anything that changes the current semantics. I'm > > all for a compiler optimization that turns " . ( > > )" into a single opcode that somehow manages to avoid c

Re: [Python-3000] Bound and unbound methods

2006-08-15 Thread Calvin Spealman
On 8/16/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 8/13/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > > Talin wrote: > > > the compiler would note the combination of the attribute access and the > > > call, and combine them into an opcode that skips the whole method > > > creation step. > >

Re: [Python-3000] Bound and unbound methods

2006-08-15 Thread Guido van Rossum
On 8/13/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > Talin wrote: > > the compiler would note the combination of the attribute access and the > > call, and combine them into an opcode that skips the whole method > > creation step. > > Something like that could probably be made to work. You'd > want

Re: [Python-3000] Bound and unbound methods

2006-08-13 Thread Greg Ewing
Talin wrote: > the compiler would note the combination of the attribute access and the > call, and combine them into an opcode that skips the whole method > creation step. Something like that could probably be made to work. You'd want to be careful to do the optimisation only when the attribute

Re: [Python-3000] Bound and unbound methods

2006-08-13 Thread Nick Coghlan
Talin wrote: > Anyway, I just wanted to throw that out there. Feel free to -1 away... :) Based on the later discussion, I see two interesting possibilities: 1. A special CALL_METHOD opcode that the compiler emits when it spots the ".NAME(ARGS)" pattern. This could simply be an optimisation perfo

[Python-3000] Bound and unbound methods

2006-08-13 Thread tomer filiba
[Josiah] > I'm -1 for instantiating all methods (for the infinite cost reasons), > and -1 for int, long, list, tuple, dict, float (method access is > generally limited for these objects). I'm +0 for offering a suitable > metaclass and/or decorator, but believe it would be better suited for > the P

Re: [Python-3000] Bound and unbound methods

2006-08-13 Thread Andrew Koenig
> However, I also realize that requiring every access to a class variable > to instantiate a new method object is expensive, to say the least. Why does every access to a class variable have to instantiate a new method object? ___ Python-3000 mailing li

Re: [Python-3000] Bound and unbound methods

2006-08-13 Thread Thomas Wouters
On 8/13/06, Talin <[EMAIL PROTECTED]> wrote: HI wonder if it could be me made to work in abackwards-compatible way. In other words, suppose the existing logic ofcreating a method object were left in place, however the'obj.instancemethod()' pattern would bypass all of that. In other words, t

Re: [Python-3000] Bound and unbound methods

2006-08-13 Thread Talin
Josiah Carlson wrote: > Talin <[EMAIL PROTECTED]> wrote: >> One of the items in PEP 3100 is getting rid of unbound methods. I want >> to explore a heretical notion, which is getting rid of bound methods as >> well. >> >> Now, to be honest, I rather like bound methods. I like being able to >> cap

Re: [Python-3000] Bound and unbound methods

2006-08-13 Thread Josiah Carlson
Talin <[EMAIL PROTECTED]> wrote: > > One of the items in PEP 3100 is getting rid of unbound methods. I want > to explore a heretical notion, which is getting rid of bound methods as > well. > > Now, to be honest, I rather like bound methods. I like being able to > capture a method call, store

Re: [Python-3000] Bound and unbound methods

2006-08-13 Thread Steven Bethard
On 8/13/06, Talin <[EMAIL PROTECTED]> wrote: > One of the items in PEP 3100 is getting rid of unbound methods. I want > to explore a heretical notion, which is getting rid of bound methods as > well. I believe you're suggesting that the code that I just wrote moments ago would stop working::

[Python-3000] Bound and unbound methods

2006-08-13 Thread Talin
One of the items in PEP 3100 is getting rid of unbound methods. I want to explore a heretical notion, which is getting rid of bound methods as well. Now, to be honest, I rather like bound methods. I like being able to capture a method call, store it in a variable, and call it later. However, I