[Patches] [ python-Patches-825313 ] Add additional isxxx functions to string object.

SourceForge.net noreply at sourceforge.net
Sat Oct 18 05:58:33 EDT 2003


Patches item #825313, was opened at 2003-10-17 07:47
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=825313&group_id=5470

Category: Core (C code)
Group: Python 2.4
Status: Open
Resolution: None
Priority: 4
Submitted By: Eric Huss (ehuss)
Assigned to: Nobody/Anonymous (nobody)
Summary: Add additional isxxx functions to string object.

Initial Comment:
This patch adds the following ctype.h functions to the 
string object.

iscntrl
isgraph
isprint
ispunct
isxdigit

These are pretty standard C functions...I'm not sure 
why they were left out.

It also deletes a lot of duplicated code.

This patch might not be 100% useful because it does 
not have the unicode equivalents.  Thoughts?


----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2003-10-18 11:58

Message:
Logged In: YES 
user_id=21627

The patch is incomplete, as it comes without documentation
and test cases. Eric, I would normally request these at this
point, but I'm also with Brett that wrapping these functions
might be useless.

What is the rationale for including them?

----------------------------------------------------------------------

Comment By: Brett Cannon (bcannon)
Date: 2003-10-17 21:53

Message:
Logged In: YES 
user_id=357491

I don't really see a good use for any of these.  Chances that most 
people are going to need most of these is very minor (heck, I 
don't even know what isgraph would test for).

isxdigit might be slightly helpful if you renamed it isnum, but you 
can fake that already with ``x.isalnum() and not x.isalpha()``.

But in general I am -1 on these.  str has enough methods as it is.

----------------------------------------------------------------------

Comment By: Andrew Gaul (gaul)
Date: 2003-10-17 21:26

Message:
Logged In: YES 
user_id=139865

I like shedding ~80 lines with is_helper, especially if you
add inline.  Otherwise, function call overhead might be
incurred for every call to C isfoo() instead of inlining the
comparison.  I dislike increasing the distinction between
ASCII and Unicode strings, although Unicode strings already
have isdecimal and isnumeric methods which ASCII strings
lack.  I would at least add iscntrl, ispunct, and isxdigit
to Unicode strings if they are added to ASCII strings.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=825313&group_id=5470



More information about the Patches mailing list