Re: strop module and whitespace

Jon Vander Hill (jcv26@cas.org)
Thu, 8 Jul 93 07:29:50 EDT

>>>>> On Thu, 08 Jul 1993 10:31:47 +0200, Guido.van.Rossum@cwi.nl said:

>> 1) why is \r not considered whitespace?

> Perhaps because \r is really a arbitrary control character (Python
> uses UNIX' convention that \n is the line separator). Or perhaps it's
> an oversight. What set of characters does ANSI C define to be
> whitespace? Should \f be added too?

>> 2) even if I fix whitespace in string.py, it is not being picked up
>> because it has been hardcoded in module strop to be space, \t and
>> \n. (string.py imports strop.)

> Same reason, and I thought it wasn't ever going to matter. Do you
> think it is sufficient if I fix this by adding \r (and \f) to the
> hardcoded list, or do you think we'll need a more general routine?

> A possibility, if people think this is worth it, would be to somehow
> find out which characters the C library's "isspace()" function
> considers whitespace and use this definition throughout.

> Feedback, please!

In C source files, ANSI C defines whitespace to include tab (0x09),
newline (0x0a), vertical tab (0x0b), formfeed (0x0c), carriage return
(0x0d), space (0x20), and comments. I don't have doc on the ANSI
C library routines.

The SunOS (non-ANSI) isspace() says all of the above (except comments)
are whitespace.

Jon Vander Hill
jon@cas.org