Re: [Twisted-Python] composition VS. inheritance

2020-06-30 Thread Glyph
> On Jun 30, 2020, at 12:26 PM, meejah wrote: > > I recently wrote a relatively simple protocol to try this "sans-io" style > and was happy to start with the state-machine (using Automat). This > forced some good decisions. Then I worked outwards to the "more boring" > bits (framing and serializ

Re: [Twisted-Python] composition VS. inheritance

2020-06-30 Thread meejah
As others have pointed out, you're stuck with a certain amount of inheritance to use Twisted. However, this can be fairly minimal. For new code trying to follow a "sans-io" approach is good too. The go-to example of this for Twisted is Hyper/H2 and its integration into Twisted Web for HTTP2 suppor

Re: [Twisted-Python] composition VS. inheritance

2020-06-30 Thread Barry Scott
On Saturday, 27 June 2020 07:47:14 BST Ian Haywood wrote: > In smb I have a SMBPacketReceiver that inherits from t.i.p.Protocol, it > breaks the incoming TCP stream into logical packets (the analogue of > LineReceiver in line-based protocols). > > I then subclass SMBPacketReceiver to SMBProtocol