[Twisted-Python] Re: Where is best place to put my custom code?
lists at webcrunchers.com
Mon Jan 5 21:59:26 EST 2004
On Jan 2, 2004, at 7:20 PM, Andrew Bennetts wrote:
> The only reason you should have for calling sendLine in an IRCClient
> subclass is to extend its functionality to support more of the
> protocol than
> it already does. IRCClient already has support for signing on (the
> 'register' method and the 'signedOn' handler), so you shouldn't use
> for that. IRCClient currently lacks some IRC features, such as WHO,
> so to
> do those you do need sendLine.
That's what I thought. Did you take a look at that code sample I sent
I hacked that up myself, with few examples, so I can see where i
put things in places they weren't intended to be.
I want to really learn Twisted, and to be able to put pieces together
having to be constantly digging for example code, and twiddling with
> Also, good style suggests that you probably shouldn't mix your
> code with your IRCClient extensions, i.e. subclass IRCClient for WHO
> (and other other unimplemented commands you need), and then subclass
> for your application.
I don't quite understand. Because in my case, my application just
a client long enough to extract some information from the IRC server,
a "who" command and extract the data.
I always thought it was appropriate to sub-class the part i want to do,
parts that are not implemented by the parent, as in my case of wanting
to do the "who" command, so I treated the command like any other
IRC command that issues commands and gets back data.
So If I can't mix my application code with a sub_class of a IRCClient,
how is the right way to do it.
More information about the Twisted-Python