[Python-checkins] CVS: python/dist/src/Tools/modulator modulator.py,1.7,1.8

Fred L. Drake fdrake@users.sourceforge.net
Fri, 20 Jul 2001 11:57:34 -0700


Update of /cvsroot/python/python/dist/src/Tools/modulator
In directory usw-pr-cvs1:/tmp/cvs-serv32137/modulator

Modified Files:
	modulator.py 
Log Message:

Use string.ascii_letters instead of string.letters (SF bug #226706).
Move computation of sets of characters out of the body of the function that
uses them.


Index: modulator.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/modulator/modulator.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** modulator.py	1999/02/18 14:22:05	1.7
--- modulator.py	2001/07/20 18:57:32	1.8
***************
*** 31,41 ****
  oops = 'oops'
  
  # Check that string is a legal C identifier
  def checkid(str):
      if not str: return 0
!     if not str[0] in string.letters+'_':
          return 0
      for c in str[1:]:
!         if not c in string.letters+string.digits+'_':
              return 0
      return 1
--- 31,44 ----
  oops = 'oops'
  
+ IDENTSTARTCHARS = string.ascii_letters + '_'
+ IDENTCHARS = string.ascii_letters + string.digits + '_'
+ 
  # Check that string is a legal C identifier
  def checkid(str):
      if not str: return 0
!     if not str[0] in IDENTSTARTCHARS:
          return 0
      for c in str[1:]:
!         if not c in IDENTCHARS:
              return 0
      return 1