[Python-Dev] String module

M.-A. Lemburg mal@lemburg.com
Fri, 31 May 2002 09:38:31 +0200


Guido van Rossum wrote:
>>>Someone commented that isxdigit is a poor name.  OTOH it's what C
>>>uses.  I'm not sure what to say.
>>
>>I concur.  I had to look it up on google to make sure in meant
>>what I surmised it meant.  ishexdigit() is more explicit.
>>Besides, C naming conventions aren't exactly role models for clarity ;)
>>
>>While we're at it:
>> isgraph() --> isvisible()
>> iscntrl() --> iscontrol()
>> isprint() --> isprintable()
> 
> 
> Sure.  But I still can't guess the relationships between these three
> graph excludes space, print includes it).
> 
> And then maybe also ispunctuation()?  Or is that too long?
> 
> My ctype.h man page also has these:
> 
> isblank -- space or tab (GNU extension)
> isascii -- 7-bit value (BSD/SVID extension)

Do you really think this proliferation of issomething()
methods is a good idea ?

The same can be had using re.metch() with *much* more flexibility
since you're not stuck with an "intuitive" definition relying
on the intuition of some non-standard body.

FWIW, I've never used a single one of these single
character based classification APIs. The only non-trivial
issomething() method I can think of is .istitle() because
of it's complicated definition. All others can easily
be had with re.match().

I'm -0 on adding more of these .issomething() APIs
to strings and Unicode.

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/
Meet us at EuroPython 2002:                 http://www.europython.org/