"Martin Marcher" <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> could you have a short review of my CLI package.

Hi,
it looks alright, it's really rather tiny. For one I could do with
spaces between functions for the sake of readability. And it would
make more sense to check the callback for being a callable once - while
registering it, instead of every time it's triggered. It's good to
program defensively, especially in a dynamic language like python,
where you can hardly stop anyone (yourself) from stuffing the dict
with uncallable garbage. But in this case, you deserve the exception as
it's up to you, the programmer, to register the commands. The check
should not be necessary if you write your program correctly.

As for CTRL+D, it fires an EOF. The manual for readline() says:
> A trailing newline character is kept in the string
> An empty string is returned when EOF is encountered immediately.
but you strip() the command (in two places) and lose the chance of
checking for that very case. Hope this helps.

tezlo
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to