How do I display unicode value stored in a string variable using ord()

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Aug 20 00:21:04 EDT 2012


On Sun, 19 Aug 2012 19:24:30 -0400, Roy Smith wrote:

> In the primordial days of computing, using 8 bits to store a character
> was a profligate waste of memory.  What on earth did people need with
> TWO cases of the alphabet 

That's obvious, surely? We need two cases so that we can distinguish 
helping Jack off a horse from helping jack off a horse.


> (not to mention all sorts of weird
> punctuation)?  Eventually, memory became cheap enough that the
> convenience of using one character per byte (not to mention 8-bit bytes)
> outweighed the costs.  And crazy things like sixbit and rad-50 got swept
> into the dustbin of history.

8 bit bytes are much older than 8 bit characters. For a long time, ASCII 
characters used only 7 bits out of the 8.


> So it may be with utf-8 someday.

Only if you believe that people's ability to generate data will remain 
lower than people's ability to install more storage.

Every few years, new sizes for storage media comes out. The first thing 
that happens is that people say "40 megabytes? I'll NEVER fill this hard 
drive up!". The second thing that happens is that they say "Dammit, my 40 
MB hard drive is full, and a new one is too expensive, better delete some 
files." Followed shortly by "400 megabytes? I'll NEVER use that much 
space!" -- wash, rinse, repeat, through megabytes, gigabytes, terrabytes, 
and it will happen for petabytes next.

So long as our ability to outstrip storage continues, compression and 
memory-efficient storage schemes will remain in demand.



-- 
Steven



More information about the Python-list mailing list