Menu

#653 Remove caching of enumerators

v1.0 (example)
open
nobody
None
5
2013-07-22
2013-07-22
No

Caching of enumerator is could lead to an error depending on the implementation of the base collection. If the collection returns the enumerator with a copy of the current state to provide a safe enumeration any changes to the collection are not available in the enumerator.
In conjunction with the use of the enumerator in the getitem method this could lead to unexpected behavior. E.g.
Col = Application.Collection
Col.Add()
print Col[0] # Cache the current state
Col.Add() 
Col.Add()
Col.Count # 3
print Col[2] # Error since the cached collection has only one element.

The attached patch changes the current behavior.

1 Attachments

Discussion