[Tutor] Some sample code: review?

Alan Gauld alan.gauld at btinternet.com
Fri Nov 10 13:36:52 CET 2006

"Kent Johnson" <kent37 at tds.net> wrote

>>      def register(self, handler):
>>          """register: (object (object -> string) -> string or None)
> Maybe it's just me but I don't have a clue what 'object (object ->
> string)' is trying to convey.

This might be an interesting test of the legibility but I read that
as being:

register takes a handler argument that should be a callable object
which in turn takes a stringlike argument and returns either a string
or None


def f(s):
   if s and isinstance(s,str) : return s
   else: return None

f would be a valid value for handler.

Is that what you meant Danny?

Otherwise I agree with all that Kent has said.

Alan G.

More information about the Tutor mailing list