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

Ran Benita ran234 at gmail.com
Tue Oct 21 12:30:29 PDT 2014


On Tue, Oct 21, 2014 at 09:11:03PM +0200, Christian Linhart wrote:
> 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.

Thanks!

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

Oops, here it is:

diff --git a/src/c_client.py b/src/c_client.py
index 1b61082..e2b553f 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -1876,7 +1876,7 @@ def _c_accessors_list(self, field):
         if len(self) == 0:
             return ''
         else:
-            return (',\n' + indent).join([''] + map(lambda p: '%s %s /**< */' % p, self))
+            return (',\n' + indent).join([''] + ['%s %s /**< */' % p for p in self])
 
     _h_setlevel(1)
     _c_setlevel(1)

> 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.

Thanks!

In this case it looks like you can also close over the
`additional_params` variable instead of passing it as a parameter. But
that's up to personal preference.

Ran

> 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


More information about the Xcb mailing list