the annoying, verbose self

MonkeeSage MonkeeSage at gmail.com
Tue Nov 27 04:35:13 EST 2007


On Nov 27, 3:20 am, Roy Smith <r... at panix.com> wrote:

> If you want to have a little fun:
>
> class peverse:
>     def __call__(self):
>         raise AttributeError ("peverse instance has no __call__ method")
>
> x = peverse()
> x()

That is "peverse", but still...

from types import FunctionType
type(x) == FunctionType # False

And you can't (easily?) subclass FunctionType:

Error when calling the metaclass bases
  type 'function' is not an acceptable base type

;)

Regards,
Jordan



More information about the Python-list mailing list