N
Neil Cerutti
List and deque disagree on what __init__ does. Which one is
right?
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
test_deque.py even contains a test verifying its __init__
behavior, so perhaps deque has a good reason to differ from the
behavior of list.
Moreover, both methods use the same doc string, i.e.:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
When implementing a list-like container extension type, is there
any reason to choose anything other than list-like behavior,
i.e., if you call __init__, you'll initialize the container?
deque's behavior doesn't make sense to me.
right?
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
[2, 3]from collections import deque
x = deque([0, 1])
x.__init__([2, 3])
x deque([0, 1, 2, 3])
y = list([0, 1])
y.__init__([2, 3])
y
test_deque.py even contains a test verifying its __init__
behavior, so perhaps deque has a good reason to differ from the
behavior of list.
Moreover, both methods use the same doc string, i.e.:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
When implementing a list-like container extension type, is there
any reason to choose anything other than list-like behavior,
i.e., if you call __init__, you'll initialize the container?
deque's behavior doesn't make sense to me.