conceiling function calls..

Gonçalo Rodrigues op73418 at mail.telepac.pt
Fri Nov 14 13:39:12 CET 2003


On Wed, 12 Nov 2003 23:30:24 +0100, "Carlo v. Dango" <oest at soetu.eu>
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... )
>
>I would like something like
>
>
>def f():
>     return tnaheusnthanstuhn
>
>
>class A(object):
>     def foo(self):
>         f.bar()
>
>
>as it is now I have to write
>
>class A(object):
>     def foo(self):
>         f().bar()
>

Can you explain why you would want to do that? What possible gain can
you have by counfounding name lookup with calling?

Btw, as far as I know it can't be done. Even if functions were
subclassable (and they're not) I just don't know how to instruct
Python such that every time you look up a bare name referencing a
function you end up calling it. But then again this request sounds so
bizarre...

With my best regards,
G. Rodrigues




More information about the Python-list mailing list