qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 08/15] python/aqmp: Create MessageModel and StandaloneModel c


From: Hanna Reitz
Subject: Re: [PATCH 08/15] python/aqmp: Create MessageModel and StandaloneModel classes
Date: Fri, 17 Sep 2021 15:39:00 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 17.09.21 07:40, John Snow wrote:
This allows 'Greeting' to be subclass of 'Message'. We need the adapter
classes to avoid some typing problems that occur if we try to put too
much into the 'Model' class itself; the exact details of why are left as
an exercise to the reader.

Why bother? This makes 'Greeting' ⊆ 'Message', which is taxonomically
true; but the real motivation is to be able to inherit and abuse all of
the Mapping dunders so that we can call dict(greeting) or
bytes(greeting), for example.

Signed-off-by: John Snow <jsnow@redhat.com>
---
  python/qemu/aqmp/models.py | 67 ++++++++++++++++++++++++++++----------
  1 file changed, 50 insertions(+), 17 deletions(-)

(I feel like this is a bit much outside of my scope, so this’ll have to do without my R-b.)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]