stupid perl question

Jorgen Grahn grahn+nntp at snipabacken.dyndns.org
Tue May 30 15:55:22 EDT 2006


On Sat, 27 May 2006 11:11:40 +1000, John Machin <sjmachin at lexicon.net> wrote:
...
> Yes, you could write out the whitespace characters for the 8-bit 
> encoding of your choice, or you could find them using Python (and get 
> some possibly surprising answers):
>
> >>> mkws = lambda enc, sz=256: "".join([chr(i) for i in range(sz) if 
> chr(i).decode(enc, 'ignore').isspace()])
...
> >>> mkws('latin1')
> '\t\n\x0b\x0c\r\x1c\x1d\x1e\x1f \x85\xa0'
                                      ^^^^
That surprised me, at least. Should NO-BREAK SPACE really count as
whitespace? I thought that the whole purpose with it was to have a blank
character which programs automatically treated as non-whitespace, for
line-breaking, word-counting and similar purposes.

/Jorgen

-- 
  // Jorgen Grahn <grahn@        Ph'nglui mglw'nafh Cthulhu
\X/     snipabacken.dyndns.org>  R'lyeh wgah'nagl fhtagn!



More information about the Python-list mailing list