Dan Sugalski <[EMAIL PROTECTED]> writes:
> I know (now) that python lets you have an interceptor method that gets
> called before a named method is called even. Does it allow this method
> to be generated by the generic fallback method?

Python doesn't really have "interceptor methods". In fact, there
aren't any magic methods that are called specifically on method
calling -- only attribute access (well, except for __call__, which
happens when you do obj(), but that's a separate step in the process).


__getattribute__(self, name) --> Always called on attribute access.

__getattr__(self, name) --> Called after looking up the attribute
                            fails by regular means.

__get__(self, obj, type=None) --> Called on an object when that object
                                  is accessed as an attribute of
                                  another object. f34r this. :-)

Any of which, of course, can return methods. :-) btw, remember how
Python creates `bound methods' when you access a method through an
instance? It's implemented with (the C equivalent of) __get__ (As of
Python 2.2). More information related to that (and other useful
information in general) is here:
http://www.python.org/2.2.2/descrintro.html.

Btw, these all have `set' and `del' friends, but they don't always
perfectly match up with the `get's... I'll get back to you on that.

-- 
 Twisted | Christopher Armstrong: International Man of Twistery
  Radix  |          Release Manager,  Twisted Project
---------+     http://twistedmatrix.com/users/radix.twistd/

Reply via email to