[Tutor] isinstance() evil?
Terry Carroll
carroll at tjc.com
Thu Dec 4 00:56:03 EST 2003
On Thu, 4 Dec 2003, Alan Gauld wrote:
> Writing debug code is not a normal thing to do - it's why
> we have debuggers, so that you don't normally need to!
Well, this is playing with Chinese characters, so I can't just use print
statements. My routine basically gives me the equivalent of a print
statement, only using Tkinter, so I can see the character along with the
other data in a structure.
In addition to debugging, it also gives a quick and dirty way to give me
output for a quick one-off program. Just like in a one-off you might
have:
[do lots of things to calculate a value for x]
print x
I can do a lot of stuff to look up a certain character, and then print the
character and its associated data (pinyin romanization, English
equivalent, and Unicode value if it's encoded in one of the other systems
like GB or Big5).
My main use for this is looking up a character and its pinyin equivalent
when I have an MP3 with Chinese characters in the ID3 data, or an MP3 or
video file with Chinese characters in the filename.
> Yep, that looks pretty reasonable for dumping a recursive data
> structure.
Thanks.
--
Terry Carroll
Santa Clara, CA
carroll at tjc.com
More information about the Tutor
mailing list