[Python-checkins] CVS: python/dist/src/Lib getopt.py,1.15,1.16

Fred L. Drake fdrake@users.sourceforge.net
2001年12月11日 22:20:37 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv13662/Lib
Modified Files:
	getopt.py 
Log Message:
Wrapped a long line.
Converted to use "".startswith() to avoid slicing (& temp string creation).
Index: getopt.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/getopt.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** getopt.py	2001年01月20日 23:34:12	1.15
--- getopt.py	2001年12月12日 06:20:34	1.16
***************
*** 69,73 ****
 args = args[1:]
 break
! if args[0][:2] == '--':
 opts, args = do_longs(opts, args[0][2:], longopts, args[1:])
 else:
--- 69,73 ----
 args = args[1:]
 break
! if args[0].startswith('--'):
 opts, args = do_longs(opts, args[0][2:], longopts, args[1:])
 else:
***************
*** 125,129 ****
 if optstring == '':
 if not args:
! raise GetoptError('option -%s requires argument' % opt, opt)
 optstring, args = args[0], args[1:]
 optarg, optstring = optstring, ''
--- 125,130 ----
 if optstring == '':
 if not args:
! raise GetoptError('option -%s requires argument' % opt,
! opt)
 optstring, args = args[0], args[1:]
 optarg, optstring = optstring, ''
***************
*** 136,140 ****
 for i in range(len(shortopts)):
 if opt == shortopts[i] != ':':
! return shortopts[i+1:i+2] == ':'
 raise GetoptError('option -%s not recognized' % opt, opt)
 
--- 137,141 ----
 for i in range(len(shortopts)):
 if opt == shortopts[i] != ':':
! return shortopts.startswith(':', i+1)
 raise GetoptError('option -%s not recognized' % opt, opt)
 

AltStyle によって変換されたページ (->オリジナル) /