[libxcb] generator: support parametrized structs

Submitted by Ran Benita on Oct. 21, 2014, 7:30 p.m.

Details

Message ID 20141021193029.GA28654@ran
State Not Applicable
Headers show

Not browsing as part of any series.

Commit Message

Ran Benita Oct. 21, 2014, 7:30 p.m.
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:


> 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

Patch hide | download patch | download mbox

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)