Curious string behavior

Diez B. Roggisch deets_noospaam at web.de
Wed Jan 28 19:25:12 CET 2004


> address2 = ' '
> line = 'function, dealer, type, firstname, lastname, vin, blank'
> print 'Address2 Type (first check): ', type(address2)
> function, dealer, type, firstname, lastname, vin, blank =
                    ^^^^^
Here you rebind the name type (which is initially bound to <type 'type'>,
that can be called with an argument to get its type) to the string '  '.
Hence the second

type(address2)

doesn't work.

You can do this on all symbols/names in python, which can cause confusing
errors. 

Diez



More information about the Python-list mailing list