People debugger

A prod of a Monday morning idle brain. It goes like this:

from interfaces import IMakeSense

def getSense(person):
    """ Simple people debug tool """
    if IMakeSense.providedBy(person):
        return person.name
    else:
        return None

This can be useful in combination with a default method, something like:

def Default(person):
    alsoProvides(person, IMakeNonsense)
    return True

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>