NEWBIE: What's the instance name?

engsolnom at engsolnom at
Mon Dec 29 03:15:49 CET 2003

I've been using constructs(?) like the below.

def display(instance, start = None, end = None):

    if instance.__class__.__name__ == 'UPCA':
        do some UPCA stuff
    if instance.__class__.__name__ == 'UPCE':
        do some UPCE stuff

launched by:

lx = UPCA(sx), where sx is a string

This all works well.

What I'd like to do is display is the instance name. Is it hiding

Also, if I have a string 4 chars long, representing two bytes of hex,
how can I *validate* the string as a *legal* hex string?

isdigit works until string = '001A', for example
isalnum works, but then allows 'foob'

Is there a 'ishexdigit'? I could parse the string, but that seems

Thanks in advane....Norm

More information about the Python-list mailing list