[Xcb] [PATCH libxcb 15/18] c_client.py: simplify _c_reply_has_fds()

Christian Linhart chris at DemoRecorder.com
Sat Oct 25 08:52:15 PDT 2014


It's funny that the old implementation almost matches the definition
of builtin function "any" at
https://docs.python.org/2/library/functions.html#any

The difference is of course that we have a member access here.
That's why the iteration is needed in the argument-list of "any".

Reviewed-by: Christian Linhart <chris at demorecorder.com>


On 10/12/14 20:58, Ran Benita wrote:
> Signed-off-by: Ran Benita <ran234 at gmail.com>
> ---
>  src/c_client.py | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/src/c_client.py b/src/c_client.py
> index 686eca5..d561e04 100644
> --- a/src/c_client.py
> +++ b/src/c_client.py
> @@ -2165,10 +2165,7 @@ def _c_reply(self, name):
>      _c('}')
>  
>  def _c_reply_has_fds(self):
> -    for field in self.fields:
> -        if field.isfd:
> -            return True
> -    return False
> +    return any(field.isfd for field in self.fields)
>  
>  def _c_reply_fds(self, name):
>      '''



More information about the Xcb mailing list