[pypy-svn] r30331 - pypy/dist/pypy/translator/cli
antocuni at codespeak.net
antocuni at codespeak.net
Fri Jul 21 21:05:30 CEST 2006
Author: antocuni
Date: Fri Jul 21 21:05:26 2006
New Revision: 30331
Modified:
pypy/dist/pypy/translator/cli/database.py
Log:
Use MyClass_0, MyClass_1 etc. for building unique class names instead
of MyClass_, MyClass__, etc.
This should reduce a bit the generated code size, moreover it's easier
to read the names instead of count hundreds of underscores.
Modified: pypy/dist/pypy/translator/cli/database.py
==============================================================================
--- pypy/dist/pypy/translator/cli/database.py (original)
+++ pypy/dist/pypy/translator/cli/database.py Fri Jul 21 21:05:26 2006
@@ -128,8 +128,11 @@
return self.functions.get(graph, None)
def get_unique_class_name(self, namespace, name):
+ base_name = name
+ i = 0
while (namespace, name) in self.classnames:
- name += '_'
+ name = '%s_%d' % (base_name, i)
+ i+= 1
self.classnames.add((namespace, name))
return name
More information about the Pypy-commit
mailing list