Re: prompt_hook
Eugene <[email protected]>
| Newsgroups | gmane.comp.games.mud.client.lyntin |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 20 Apr 2004 08:22:25 -0500 (CDT) will guaraldi <[email protected]> wrote: > >Here's why I'm asking: I just reimplemented the net >module to use the >telnetlib (which is broken in regards to telnet options >in previous >versions of Python [though I can't remember which ones--I >think 2.2 but it >might have been 2.1--I keep meaning to look this up]) and >in doing so >dumped all our prompt detection stuff. > >I was originally thinking it'd be useful for things like >mappers and >anything else that really needs to link user commands >with mud responses. >Josh implemented his commandresponse module at a higher >level and it seems >to work a lot better. I was never able to get my >commandresponse module >(which worked with the prompt detection) to work. > >So, given that I couldn't use it for what I was hoping to >use it for, I'm >thinking it slows things down (running a regexp on all >incoming data...) It is another issue. I said I don't use the hook itself, but I'd like the detection stuff (including the regexp) to remain. I anyway detect a prompts by checking the incoming line with line.endswith("\n"), so I think it is convenient to have a prompt going through filters as separate line. (I rely on prompts-as-separate-lines in another my modules too.) Generally, I think prompts should be considered as separate lines themselves, not as nondelimited part of some another line which is have to come later. And it cannot be done without the regexp checking. By the way, I don't think the regexp checking eats that many of CPU; did you perform a profiling? The regexp are usually pretty fast. -- Eugene --- Professional hosting for everyone - http://www.host.ru ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click