Method/Function Signature Type checking

Adam Gent agentgt at yahoo.com
Tue Aug 13 19:32:10 CEST 2002


I'm almost certain that this has been brought up in the newsgroup
before but I can't seem to google it (find it). I like python very
much but was wondering if there is any intrest for dynamic type
checking in the method/function signature. Im not talking about
compile time/static type checking!

ie:
def blah( String st):
    pass

#Would be equal to 

def blah(st):
    if isinstance(st, String):
        raise TypeError
    else:
        #do whatever
        pass

I think this feature would be very useful to the programmer for
obvious reasons (abstract classes, source code tagging ... so on). I'm
sure this has been talked about before so pointer to previous
discussions and or PEPs would be appreciated.



More information about the Python-list mailing list