On Mon, Nov 04, 2002 at 06:28:41PM -0600, Martin Maney wrote:
> First you need to provide an instance of Folder to Quixote. Since you
> get around to that later on, I'll just sketch one simple hack to
> provide access to an object's method function without requiring the
> immediate caller to know about the instance object. First, assume that
> your view(self, request) is renamed to _view. Then you want something
> like this:
>
> def __init__(self, request):
> view = lambda r: self._view(r)
>
> Or for 2.1 and earlier, without the nested scope change, the usual
> hack:
>
> def __init__(self, request):
> view = lambda r,s=self: s._view(r)
>
> This leaves a bound function taking only the request argument that
> Quixote will find when it looks for "view" in the instance's __dict__.
I'm confused. How is that better than:
class Folder:
...
def view(self, request):
...
?
Neil