unicode, bytes redux

Robert Kern robert.kern at gmail.com
Mon Sep 25 02:49:23 EDT 2006


willie wrote:
> (beating a dead horse)
> 
> Is it too ridiculous to suggest that it'd be nice
> if the unicode object were to remember the
> encoding of the string it was decoded from?

Yes. The unicode object itself is precisely the wrong place for that kind of 
information. Many (most?) unicode objects during the lifetime of a program 
*won't* be decoded from a byte string at all; they will be formed by operations 
with other unicode objects.

I simply don't see a usecase where keeping that kind of information on the 
unicode object itself actually works. The one you suggest doesn't really make 
any sense to me.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list