[Xcb] [PATCH libxcb] generator: support parametrized structs

Christian Linhart chris at DemoRecorder.com
Tue Oct 21 12:11:03 PDT 2014


Hi Ran,

Thank you for this comment. 
I didn't know about the change of the semantic of "map".
I'll make a V2 patch which fixes that.

Your attached diff didn't make it to the list. 
Can you resend it please?

To the uses of self:
I just adapted to the general style there. ;-)
I'll change the name of that parameter in the V2 patch.

In this kind of code it's somehow hard to know which idioms to adapt to or not.

I agree of course that self should be used only in class member functions.

Chris



On 10/21/14 20:10, Ran Benita wrote:
> On Mon, Sep 08, 2014 at 02:31:08AM +0200, Christian Linhart wrote:
> [snip]
>> +    #internal function to compute the parameterlist with given indentation
>> +    #such that the formatting of the additional parameters is consistent with
>> +    #the other parameters.
>> +    def additional_params_to_str(self, indent):
>> +        if len(self) == 0:
>> +            return ''
>> +        else:
>> +            return (',\n' + indent).join([''] + map(lambda p: '%s %s /**< */' % p, self))
> 
> Haven't reviewed this one yet, but just an advance comment, or I'll
> forget.
> 
> The above line doesn't work with python3, since they changed `map` to
> reutrn an iterator instead of list, and that cannot be added.
> 
> I've fixed it with the attached diff locally. However I should also
> mention that the name `self` here is confusing - it is usually reserved
> for same as `this` in C++. It also shadows another `self`. In fact all
> uses of `self` in the generator are confusing for this reason, but oh
> well..
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb
> 



More information about the Xcb mailing list