enthought/comtypes — pull request #43 by cfarrow (2014-04-04 21:00:03+00:00)
Title: Homogenizing the collections interface.

This makes the collection interface (nearly) uniform throughout all of comtypes. Here is the summary.

* Collections (interfaces with an `Item` attribute) now have `__setitem__`. (`comtypes.client.lazybind.Dynamic` collections already had this. This PR adds it to non-dynamic interfaces.)
* `__getitem__` and `__setitem__` accept an empty slice as an index.
* Named properties explicitly overload `__iter__` to raise a `TypeError`. This prevents infinite iteration on these objects, which have `__getitem__` that may never raise an `IndexError`.
* `__getitem__` for non-dynamic collections no longer raises an `IndexError` when the lookup provides a null pointer. Getting an null pointer back from a collection does not necessarily indicate an error. Furthermore, this is consistent with the behavior of the dynamic interface.
* Dynamic named properties raise `TypeError` in `__getitem__`/`__setitem__`/`__call__` when they cannot be indexed, assigned, or called.

These changes do not affect the `comtypes.client.dynamic._Dynamic` class, which is not covered by the test suite. I am foggy under what conditions one of these is created, and would rather leave it alone for now.

This fixes #36.