[Python-Dev] Re: stringobject question

Trent Mick trentm@activestate.com
Tue, 13 Jun 2000 22:21:42 -0700


On Tue, Jun 13, 2000 at 10:53:58PM -0500, Al-Amerrho H. Amerin wrote:
> Is this a bug or a feature?:
> 
> Python 1.6a2 (#4, Jun  9 2000, 02:22:41)  [GCC 2.95.2 19991024
> (release)] on linux2
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> Copyright 1995-2000 Corporation for National Research Initiatives (CNRI)
> 
> >>> ''.isdigit()
> 1
> >>> ''.isspace()
> 1
> 

Good point, maybe. The __docs__ say:

"S.isdigit() -> int\n\
\n\
Return 1 if there are only digit characters in S,\n\
0 otherwise.";


static char isspace__doc__[] =
"S.isspace() -> int\n\
\n\
Return 1 if there are only whitespace characters in S,\n\
0 otherwise.";


I am not an English language lawyer so I could see both interpretations from
the doc strings. I agree, that the result with a zero length string is
surprising. 


Hi All,
Which should it be? Sorry, if this has been covered.



Trent


-- 
Trent Mick
trentm@activestate.com