diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2005-11-25 03:16:34 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2005-11-25 03:16:34 (GMT) |
commit | f9232678aede501ea6cde3bbbcb08de068c16153 (patch) | |
tree | df68eb76b40d0d341645e2d298ddd4ecd55b53a9 | |
parent | 89886ab2b027e8534049721d7ca81c287bd13ca4 (diff) | |
download | cpython-f9232678aede501ea6cde3bbbcb08de068c16153.zip cpython-f9232678aede501ea6cde3bbbcb08de068c16153.tar.gz cpython-f9232678aede501ea6cde3bbbcb08de068c16153.tar.bz2 |
Use sorted() builtin
-rw-r--r-- | Lib/compiler/symbols.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/Lib/compiler/symbols.py b/Lib/compiler/symbols.py index 9d4605a..c608f64 100644 --- a/Lib/compiler/symbols.py +++ b/Lib/compiler/symbols.py @@ -409,13 +409,8 @@ class SymbolVisitor: scope.generator = 1 self.visit(node.value, scope) -def sort(l): - l = l[:] - l.sort() - return l - def list_eq(l1, l2): - return sort(l1) == sort(l2) + return sorted(l1) == sorted(l2) if __name__ == "__main__": import sys @@ -443,8 +438,8 @@ if __name__ == "__main__": if not list_eq(mod_names, names2): print print "oops", file - print sort(mod_names) - print sort(names2) + print sorted(mod_names) + print sorted(names2) sys.exit(-1) d = {} @@ -463,6 +458,6 @@ if __name__ == "__main__": if not list_eq(get_names(s.get_namespace()), l[0].get_names()): print s.get_name() - print sort(get_names(s.get_namespace())) - print sort(l[0].get_names()) + print sorted(get_names(s.get_namespace())) + print sorted(l[0].get_names()) sys.exit(-1) |