[ZPT] Re: zope3-dev proposal on changing implicitly calling

Fred L. Drake, Jr. fred at zope.com
Wed Jul 16 14:27:16 EDT 2003


Florent Guillaume wrote:
 > To be honest, this sucks. I've always wanted to write
 > 
 >    context/somefunc/something/etc
 > 
 > and have TALES realize that somefunc, being a method, is callable and
 > couldn't possibly have a 'something' attribute or key.

Evan Simpson writes:
 > Can we get some concrete examples, to nail down this use case?  I would 
 > have no trouble with auto-calling objects that have type 'function' or 
 > 'instance method', since these are not legitimate candidates for 
 > attribute or key access.

You two have been in Python 1.5.2 land for too long.  ;-)

Methods are just curried functions, and functions can have arbitrary
attributes:

>>> def f():
...   pass
...
>>> def g():
...   print "gee!"
...
>>> f.foo = 12
>>> f.g = g
>>> f.foo
12
>>> f.g()
gee!

Admittedly, it's pretty unusual to do things this way.


  -Fred

-- 
Fred L. Drake, Jr.  <fred at zope.com>
PythonLabs at Zope Corporation



More information about the ZPT mailing list