[pypy-svn] r13018 - pypy/dist/pypy/translator/goal
pedronis at codespeak.net
pedronis at codespeak.net
Thu Jun 2 22:39:20 CEST 2005
Author: pedronis
Date: Thu Jun 2 22:39:20 2005
New Revision: 13018
Modified:
pypy/dist/pypy/translator/goal/query.py
Log:
pbccall: a bit more info, in particular about the different kinds of callables in the families
Modified: pypy/dist/pypy/translator/goal/query.py
==============================================================================
--- pypy/dist/pypy/translator/goal/query.py (original)
+++ pypy/dist/pypy/translator/goal/query.py Thu Jun 2 22:39:20 2005
@@ -124,7 +124,12 @@
if len(patts) != 1:
rest.append((len(fam.objects), fam.objects, patts.keys()))
else:
- cntrs = one_pattern_fams.setdefault(patts.keys()[0], [0,0])
+ kinds = dict.fromkeys([getattr(obj, '__class__', type(obj)) for obj in fam.objects]).keys()
+ kinds.sort()
+
+ flavor = tuple(kinds), patts.keys()[0]
+
+ cntrs = one_pattern_fams.setdefault(flavor, [0,0])
cntrs[0] += 1
cntrs[1] += len(fam.objects)
@@ -134,11 +139,11 @@
else:
return "%d families" % nfam
- def pretty_nels(nels):
+ def pretty_nels(kinds, nels):
if nels == 1:
- return "one callable"
+ return "one %s" % kinds[0].__name__.title()
else:
- return "in total %d callables" % nels
+ return "in total %d %s" % (nels, '|'.join([kind.__name__.title()+'(s)' for kind in kinds]))
def pretty_els(objs):
accum = []
@@ -149,8 +154,8 @@
accum.append(str(obj))
return "{%s}" % ' '.join(accum)
- for patt, (nfam, nels) in one_pattern_fams.iteritems():
- print pretty_nfam(nfam), "with", pretty_nels(nels), "with one call-pattern:", prettypatt([patt])
+ for (kinds, patt), (nfam, nels) in one_pattern_fams.iteritems():
+ print pretty_nfam(nfam), "with", pretty_nels(kinds, nels), "with one call-pattern:", prettypatt([patt])
print "- * -"
More information about the Pypy-commit
mailing list