On Sat, 16 Jul 2005 19:01:50 -0400, Peter Hansen wrote: > George Sakkis wrote: >> "Bengt Richter" <[EMAIL PROTECTED]> wrote: >>> >>> identity = ''.join([chr(i) for i in xrange(256)]) >> >> Or equivalently: >>>>>identity = string.maketrans('','') > > Wow! That's handy, not to mention undocumented. (At least in the > string module docs.) Where did you learn that, George?
I can't answer for George, but I also noticed that behaviour. I discovered it by trial and error. I thought, oh what a nuisance that the arguments for maketrans had to include all 256 characters, then I wondered what error you would get if you left some out, and discovered that you didn't get an error at all. That actually disappointed me at the time, because I was looking for behaviour where the missing characters weren't filled in, but I've come to appreciate it since. -- Steven -- http://mail.python.org/mailman/listinfo/python-list