On Wed, 14 Jun 2000, M.-A. Lemburg wrote: > > > >>> ''.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. > > I guess it's a bug... a subtle one though, because in a > certain sense both 1 and 0 are acceptable. But since > '' is considered to be false, I think that returning 0 > makes more sense. > > I'll fix this to return 0 for emtpy strings and Unicode objects. I just realized something: if you change the semantics to mean "number of digits", you'll get the right answer for all 0- and 1- length strings and unicode objects. just-an-observation-ly y'rs, Z. -- Moshe Zadka <moshez@math.huji.ac.il> http://www.oreilly.com/news/prescod_0300.html http://www.linux.org.il -- we put the penguin in .com
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4