conceiling function calls..

Alex Martelli aleax at
Thu Nov 13 18:13:16 CET 2003

Carlo v. Dango wrote:

> It is possible to conceil access to methods using the "property()"
> function so method access looks like field access.. is the same possible
> for functions (not taking any args... )

It's possible as long as the functions are accessed as attributes of 
some object -- it may be horrible, but you CAN, if you wish, write a
__getattribute__ for the "some object" to force any access to the
attribute to become a CALL to that attribute.

Thankfully, it at least can't be done for access to barenames.

You could, of course, wrap the function into an object (of the
same name if you wish) that calls it whenever "an attribute of that 
name" is accessed (SHUDDER).


More information about the Python-list mailing list