[Patches] [Patch #101507] add 'punctuation' and 'printable' consts. to stropmodule.c

noreply@sourceforge.net noreply@sourceforge.net
Mon, 18 Sep 2000 09:46:38 -0700


Patch #101507 has been updated. 

Project: 
Category: core (C code)
Status: Closed
Summary: add 'punctuation' and 'printable' consts. to stropmodule.c

Follow-Ups:

Date: 2000-Sep-14 07:15
By: fdrake

Comment:
Why not just define these as constants in string.py?  That would be more usable since strop is not necessarily available, and can be considered an implementation detail at best.

Also, note that ispunct() and isprint() are available in the curses.ascii module.
-------------------------------------------------------

Date: 2000-Sep-14 09:40
By: fdrake

Comment:
Response from Richard Mortier:
Ah -- this was originally generated because I wanted to use it in
Python 1.5.2 -- didn't realise later versions had curses.ascii

Not defining them in string.py was because I wanted the behaviour
of isprint() (in particular).

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

Date: 2000-Sep-14 09:43
By: fdrake

Comment:
My response to Richard:
But why not just take the resulting value from your patch and add a couple of lines to Lib/string.py:

printable = "..."
punctuation = "..."

If you can create an updated patch with this, and add a comment to the SourceForge interface explaining why these would be useful, we can consider it.

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

Date: 2000-Sep-15 02:17
By: rmm1002

Comment:
--- string.py.old  Sun Jul 16 13:04:30 2000
+++ string.py      Fri Sep 15 10:06:58 2000
@@ -25,6 +25,8 @@
 digits = '0123456789'
 hexdigits = digits + 'abcdef' + 'ABCDEF'
 octdigits = '01234567'
+punctuaction = """!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
+printable = digits + letters + punctuation + whitespace
 
 # Case conversion helpers
 _idmap = ''

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

Date: 2000-Sep-15 02:27
By: rmm1002

Comment:
now added to Lib/string.py instead of stropmodule.c; useful for a couple of scripts I was writing for checking output before printing it -- in general, given that the string module contains the constants "letters", "digits" et al, it seems natural that it should contain "punctuation" (and "printable" IMO, but given curses.ascii maybe not)
-------------------------------------------------------

Date: 2000-Sep-18 09:46
By: fdrake

Comment:
Checked in as Lib/string.py revision 1.52.
-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=101507&group_id=5470