identifying new not inherited methods

malkarouri at gmail.com malkarouri at gmail.com
Tue Sep 26 19:04:19 CEST 2006


George Sakkis wrote:
[...]
> I'd rather have it as a function, not attached to a specific class:
>

Thanks a lot George, that was what I was looking for. Got to
understand/appreciate inspect more.
Of course it works as a method. So, other than having it as a general
utility, I presume there is no special reason to have it as a function
rather than a method..


Fredrik Lundh wrote:
[...]
> if the command methods can have any arbitrary names, change the test to
> filter out the methods you're not interested in.  it's usually easier to
> make sure that all commands use a common name prefix, though.

Thanks a lot FL. I have actually gone down this road first. But I don't
want to use a common prefix, and filtering methods out feels for me a
probable bug source, as in remembering whenever I add a method to class
A I need to add it to the filter.

> and yes, if you haven't done so already, take a look at the "cmd" module
> before you build your own variant:
>
>      http://effbot.org/librarybook/cmd.htm

Thanks again. I know I am doing a cmd variant. Actually, that's exactly
where I started, with your cmd module page.
The reason I am doing this is mainly to use a cmd variant decoupled
from stdin/stdout, to hook in PyShell or IPython (not decided yet). Is
there a way to use cmd without assuming stdin/stdout?

Regards,

k




More information about the Python-list mailing list