On Dec 12, 8:41 am, Calvin Spealman <[EMAIL PROTECTED]> wrote: > It documents that deque.__init__ initializes it, as all __init__ > methods do. All init methods are also assumed to _only_ be called at > the start of the life of the object and never more than once, so > breaking that breaks assumption and thus the documentation isn't > wrong because you are trying to apply it to a state that shouldn't > exist.
That's overstating the case somewhat. The init methods are *typically* called only once but they are not *assumed* to be called only once. They are in-fact just like any other method except that their first invocation is automatic. The clear and re-initialize behavior of __init__ for lists is evidence. If list.__init__ was assumed to be called only once, there would be no need for the step that clears-out previous values. Also, it is not obvious what the "right" behavior is. While list.__init__ clears previous values, dict.__init__ does not. In the case of deque.__init__, the lack of clearing behavior is a bug because the API aspires to mimic lists as much as possible. Raymond -- http://mail.python.org/mailman/listinfo/python-list