Mercurial > cpython-lru_cache-weakref
comparison Lib/lib-old/codehack.py @ 16517:eee67a84e5fa legacy-trunk
String method conversion.
| author | Eric S. Raymond <esr@thyrsus.com> |
|---|---|
| date | Fri, 09 Feb 2001 11:51:27 +0000 |
| parents | 91aea1af654f |
| children | 01ae962df885 |
comparison
equal
deleted
inserted
replaced
| 16516:af88465999c7 | 16517:eee67a84e5fa |
|---|---|
| 46 code = co.co_code | 46 code = co.co_code |
| 47 name = '' | 47 name = '' |
| 48 if ord(code[0]) == SET_LINENO: | 48 if ord(code[0]) == SET_LINENO: |
| 49 lineno = ord(code[1]) | ord(code[2]) << 8 | 49 lineno = ord(code[1]) | ord(code[2]) << 8 |
| 50 line = linecache.getline(filename, lineno) | 50 line = linecache.getline(filename, lineno) |
| 51 words = string.split(line) | 51 words = line.split() |
| 52 if len(words) >= 2 and words[0] in ('def', 'class'): | 52 if len(words) >= 2 and words[0] in ('def', 'class'): |
| 53 name = words[1] | 53 name = words[1] |
| 54 for i in range(len(name)): | 54 for i in range(len(name)): |
| 55 if name[i] not in identchars: | 55 if name[i] not in identchars: |
| 56 name = name[:i] | 56 name = name[:i] |
