DescriptionThis patch (attached, works with r81) adds slicing support for repeated fields in Python. It implements retrieval, setting, and deletion for both scalar and composite repeated fields, and adds several unit tests for each method.
There was already a remove() method for repeated scalars, but not for composites. I added one without any difficulty. Did I miss something? In fact, this whole patch was pretty easy. There must be some reason it hasn't been done before.
The __eq__() method for repeated composites disallows comparing to any other sequence type, including ordinary lists. Why can't we do this?
Adding more methods to the _RepeatedScalarFieldContainer and _RepeatedCompositeFieldContainer classes makes it even more painfully obvious that they need to be merged. I'm sure we can make it polymorphic, and that'll probably be my next patch.
Patch Set 1 #Patch Set 2 : Trying again, from a different directory #Patch Set 3 : Okay, *now* it's working. Go ahead. #Patch Set 4 : Removed __setslice__ method for composites #Patch Set 5 : Okay, removed all assignment methods and remove() for composites #
MessagesTotal messages: 8
|