Access the methods of a class

Terry Reedy tjreedy at udel.edu
Sat Nov 1 03:32:32 CET 2003


"Fernando Rodriguez" <frr at easyjob.net> wrote in message
news:1225qv0ehamjpk98bk4hush1tbp6eu3kov at 4ax.com...
> Hi,
>
> I have a base class with a 'sanity-check' method. This method should
iterate
> through all the methods and check if they are all 'thunks' (zero
parameter
> functions, well actually, 1 parameter: self).

If you want to enforce 'sanity' rather than post-check, you might be
able to use a custom metaclass -- which gets the dictionary of
attributes as an argument.  But that is an expert project not for the
faint of heart.

tjr






More information about the Python-list mailing list