Some language proposals.

Jacek Generowicz jacek.generowicz at cern.ch
Fri Feb 27 03:12:52 EST 2004


aahz at pythoncraft.com (Aahz) writes:

> class Callable:
>     def __call__(self):
>         print "!"
> 
> class C:
>     def __init__(self):
>         self.foo = Callable()
> 
> C().foo()
> 
> Now tell me why this doesn't do what you want.

Because

>>> C.foo
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: class C has no attribute 'foo'

for a start.



More information about the Python-list mailing list