On Tue, Oct 14, 2003 at 09:14:31PM +0200, Gilles Lenfant wrote: | Is there changes in this usual Python builtin ? No. | if type(x) == types.UnicodeType: | Error Type: UnboundLocalError | Error Value: local variable 'type' referenced before assignment | | What did I miss ?
def demonstrate_programmer_error() : ... type("a string") ... type = "some other object" ... demonstrate_programmer_error() Traceback (most recent call last): File "<stdin>", line 1, in ? File "<stdin>", line 2, in demonstrate_programmer_error UnboundLocalError: local variable 'type' referenced before assignment
Don't assign to 'type' in your method. Use a different name for the local variable. -D -- Folly delights a man who lacks judgement, but a man of understanding keeps a straight course. Proverbs 15:21 http://dman13.dyndns.org/~dman/