diff options
author | Guido van Rossum <guido@python.org> | 2000-05-08 17:31:04 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-05-08 17:31:04 (GMT) |
commit | aad6761ccea28e0a0da6761570b18adc72e01c37 (patch) | |
tree | 731b55d5648f08e1bc755bcace1f836413cd8aae /Lib/dos-8x3/userlist.py | |
parent | 0b095bc0929fb43157019c50e3e680a29ec94a65 (diff) | |
download | cpython-aad6761ccea28e0a0da6761570b18adc72e01c37.zip cpython-aad6761ccea28e0a0da6761570b18adc72e01c37.tar.gz cpython-aad6761ccea28e0a0da6761570b18adc72e01c37.tar.bz2 |
The usual...
Diffstat (limited to 'Lib/dos-8x3/userlist.py')
-rwxr-xr-x | Lib/dos-8x3/userlist.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Lib/dos-8x3/userlist.py b/Lib/dos-8x3/userlist.py index a60d8ce..7bd0298 100755 --- a/Lib/dos-8x3/userlist.py +++ b/Lib/dos-8x3/userlist.py @@ -1,13 +1,16 @@ -# A more or less complete user-defined wrapper around list objects +"""A more or less complete user-defined wrapper around list objects.""" class UserList: - def __init__(self, list=None): + def __init__(self, initlist=None): self.data = [] - if list is not None: - if type(list) == type(self.data): - self.data[:] = list + if initlist is not None: + # XXX should this accept an arbitary sequence? + if type(initlist) == type(self.data): + self.data[:] = initlist + elif isinstance(initlist, UserList): + self.data[:] = initlist.data[:] else: - self.data[:] = list.data[:] + self.data = list(initlist) def __repr__(self): return repr(self.data) def __cmp__(self, other): if isinstance(other, UserList): |