From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZheYQ-0002pg-V8 for qemu-devel@nongnu.org; Thu, 01 Oct 2015 10:09:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZheYM-00086W-R9 for qemu-devel@nongnu.org; Thu, 01 Oct 2015 10:09:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZheYM-00086Q-BH for qemu-devel@nongnu.org; Thu, 01 Oct 2015 10:09:46 -0400 References: <87oaglslwv.fsf@blackfin.pond.sub.org> <1443586423-28835-1-git-send-email-eblake@redhat.com> <87wpv7m81f.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <560D3EA4.9000204@redhat.com> Date: Thu, 1 Oct 2015 08:09:40 -0600 MIME-Version: 1.0 In-Reply-To: <87wpv7m81f.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mIwvmD1MnGeuJ6nJXihPvEgNXXVHun36U" Subject: Re: [Qemu-devel] [RFC PATCH] qapi: Use callback to determine visit filtering List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --mIwvmD1MnGeuJ6nJXihPvEgNXXVHun36U Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/01/2015 12:12 AM, Markus Armbruster wrote: >> >>> We can always add an indirection: instead of parameterizing a fixed >>> predicate (ignore and isinstance(entity, ignore)) with a type ignore,= we >>> could pass a predicate, i.e. a function mapping entity to bool. >> >> Like this? Generates the same code before and after the >> patch. I'm open to suggestions on any way to make it more >> idiomatic python, althouth it at least passed pep8. In >> particular, I'm wondering if the predicate should have its >> sense reversed (pass False to skip, True to visit). >> >> I'll probably drop the 'assert info' lines in the two >> visit_object_type() calls (I put it there to make sure the >> predicate was working). >=20 > Yes, please. Returning True to visit and False to skip was easier to rationalize about, so I've made that change in my local tree. >=20 > I think this turned out rather nicely. >=20 > Can we go one step further? Unconditionally call visitor.visit_filter(= ) > here, define the pass-everything filter in QAPISchemaVisitor, override > it as needed. >=20 > Name it visit_filter_out() to make the sense of the return value > obvious? Oh, nice idea. Then we don't even have to return it during visit_begin() - we just blindly call it. Will work that into my local tree, and it will be ready when I post (the next subset) of v6. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --mIwvmD1MnGeuJ6nJXihPvEgNXXVHun36U Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWDT6kAAoJEKeha0olJ0NqFkwIAJ1+soooAb3azSebJ5v0qskp shB3+btqn4wtk4TAEgxerSg1PJu/pL2IN53nS+FlL1ozZs4UhcqnhCNFdChpXwSf zPz3YBv2vOpugejIGsM6yRcKhN2AHiAHk7kizlhvBqq8F35w7TL/RZqBB+uE3M96 C80Lpcj92582cPQx5Wmt7YBy83W/RCEvUtn4cTRzhYD2QpgH4HeFwfCNQ7h0sbX/ ebK0BWq9QqZ+l9Jy7TbLUbIOtqJFc44R3OhTS8SCzGGrJYCfpxWkAecaMJ90ax7y ALcJLiVYN1AG4tUfRxW9rcL2ZqYaj4lIxRloa+u8W34b9GQPXSgJaRJFte2MCno= =5VS7 -----END PGP SIGNATURE----- --mIwvmD1MnGeuJ6nJXihPvEgNXXVHun36U--