On Wed, Nov 5, 2008 at 2:53 PM, Kenton Varda <[EMAIL PROTECTED]> wrote:
> [cc'ing Petar] > > > On Tue, Nov 4, 2008 at 11:23 PM, DVusBoy <[EMAIL PROTECTED]> wrote: > >> >> Hi, >> >> I have a couple of questions regarding the Python implementation. >> >> 1. There is a discrepancy between the function signatures of the >> prototype in google.protobuf.message.Message.ListFields(self, >> field_name) vs the actual implementation under >> google.protobuf.reflection._AddListFieldsMethod.ListFields(self). >> While it doesn't seem to hurt much as the concrete implementation >> trumps the prototype. It does look a bit weird that ListFields() >> should take a field_name argument. > > I'll fix this. >> 2. I also am wondering why doesn't a repeated field behaves more like >> a list in Python? Perhaps it is in keeping API consistency with the C+ >> + implementation, but why can I not do the following, for instance? >> >> message.repeated = [ 1, 2, 3 ] > > This (the slice assignment in general, like m.repeated[0:1] = [1, 2, 3]) was discussed some time ago. It isn't at all hard to add, the concern is that the it doesn't have a straight forward alternative in the C++ API (it can be done in the C++ API, but in a more complicated way). This may be a problem for the Python/C API that we are planing to have. It will be a Python C extension providing the same API as currently the pure Python API. If we allow slice assignment now, it will be very hard to forbid it if it turns to be a problem with the C extension. >> >> Thanks you for your insight, >> >> -kc >> >> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~----------~----~----~----~------~----~------~--~---