Re: Python bound and unbound methods

2004-10-07 Thread Leopold Toetsch
Jeff Clites [EMAIL PROTECTED] wrote: 2) I'd expect the method cache to be per-class, but Python can change an attribute slot on a per-instance basis (as well as a per-class basis), so we can't really use a per-class method cache (or, we need a flag on particular instances which tell us not to

Re: Python bound and unbound methods

2004-10-07 Thread Jeff Clites
On Oct 6, 2004, at 11:49 PM, Leopold Toetsch wrote: Jeff Clites [EMAIL PROTECTED] wrote: 3) I won't mention the problem of languages which allow an object to have instance variables and instance methods of the same name (so that in Python, a.b would be ambiguous if a is an object from such a

Python bound and unbound methods

2004-10-06 Thread Jeff Clites
Python's method call semantics allows you to look up a method of an object as an attribute, store it in a variable, and later invoke it like a regular function. This works similarly if you do the lookup on the class object, but when you invoke the function you need to pass in an instance as an

Re: Python bound and unbound methods

2004-10-06 Thread Leopold Toetsch
Jeff Clites [EMAIL PROTECTED] wrote: Do we have plans on how we might implement this via Parrot? Sure. To put it another way, the expression foo.bar() in Python doesn't really parse as invoke method bar on object foo, but rather as lookup attribute bar on object foo Well, there isn't much

Re: Python bound and unbound methods

2004-10-06 Thread Jeff Clites
On Oct 6, 2004, at 1:11 AM, Leopold Toetsch wrote: Jeff Clites [EMAIL PROTECTED] wrote: To put it another way, the expression foo.bar() in Python doesn't really parse as invoke method bar on object foo, but rather as lookup attribute bar on object foo Well, there isn't much difference here. invoke

Re: Python bound and unbound methods

2004-10-06 Thread Brent 'Dax' Royal-Gordon
Jeff Clites [EMAIL PROTECTED] wrote: Python's method call semantics allows you to look up a method of an object as an attribute, store it in a variable, and later invoke it like a regular function. Random note: this sounds very much like a Df^H^HC# delegate. This works similarly if you do