Mercurial > cpython-lru_cache-weakref
view Tools/scripts/suff.py @ 19975:4e445a3e07c6 legacy-trunk
Enable two checks for comparing a complex to a complex subtype
instance.
Split a string comparison test in two halves, replacing "a==b==a" with
separate tests for a==b and b==a. (Reason: while experimenting, this
test failed, and I wanted to know if it was the first or the second ==
operator that failed.)
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 19 Sep 2001 01:16:16 +0000 |
| parents | 14a27acc755a |
| children | 93c92f20b6bf |
line wrap: on
line source
#! /usr/bin/env python # suff # # show different suffixes amongst arguments import sys def main(): files = sys.argv[1:] suffixes = {} for file in files: suff = getsuffix(file) if not suffixes.has_key(suff): suffixes[suff] = [] suffixes[suff].append(file) keys = suffixes.keys() keys.sort() for suff in keys: print `suff`, len(suffixes[suff]) def getsuffix(file): suff = '' for i in range(len(file)): if file[i] == '.': suff = file[i:] return suff main()
