diff options
Diffstat (limited to 'minidinstall/OrderedDict.py')
| -rw-r--r-- | minidinstall/OrderedDict.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/minidinstall/OrderedDict.py b/minidinstall/OrderedDict.py index 7c842b0..dab57db 100644 --- a/minidinstall/OrderedDict.py +++ b/minidinstall/OrderedDict.py @@ -1,10 +1,10 @@ -# OrderedDict.py +# OrderedDict -*- mode: python; coding: utf-8 -*- # # This class functions almost exactly like UserDict. However, when using # the sequence methods, it returns items in the same order in which they # were added, instead of some random order. # -# Copyright 2001 Adam Heath <doogie@debian.org> +# Copyright (c) 2001 Adam Heath <doogie@debian.org> # # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ class OrderedDict(UserDict): def __init__(self, dict=None): UserDict.__init__(self) self.__order=[] - if dict is not None and dict.__class__ is not None: + if dict and dict.__class__: self.update(dict) def __cmp__(self, dict): @@ -57,8 +57,7 @@ class OrderedDict(UserDict): def copy(self): if self.__class__ is OrderedDict: return OrderedDict(self) - import copy - return copy.copy(self) + return self.copy() def keys(self): return self.__order @@ -70,7 +69,7 @@ class OrderedDict(UserDict): return list(map(lambda x, self=self: self.__getitem__(x), self.__order)) def update(self, dict): - for k, v in list(dict.items()): + for (k, v) in list(dict.items()): self.__setitem__(k, v) # vim:ts=4:sw=4:et: |
