Home

On 8/19/07, James Stroud <jstroud@mbi.ucla.edu> wrote:
> This was the poor design I was hinting to. do_foobar is type-checking
> for ticker. "Casting" as you might think of it does not exist in python.
> Creating new objects based on the values of existing objects (lets call
> it "conversion" for lack of a better name) does (e.g. int(2.0)). But
> this is not casting. Unless you have the power to re-author all of the
> do_foobar()s to not type-check, you should create an instance of ticker
> and pass that:
>
> t = ticker(param1, param2, parametc)
> [...]
> anobj.do_foobar(t)
>
> The "got nothing instead" means that you should have passed an
> argument--and unfortunately whoever authored do_foobar() type-checked
> for a ticker, which is not a desirable way to design an API.

I designed the system using this 'tutorial'
http://lucumr.pocoo.org/blogarchive/python-plugin-system

With your help and revisiting the article I figured out that this call works:
>>> for plugin in get_plugins_by_capability('do_foobar'):
plg=plugin()
print plg.do_foobar()

--
Thanks, Joe

previous
next

Re: status of Programming by Contract (PEP 316)?
Re: Frustrating bug in C++ program (Code for GUTTED testing version of main program now available)
Re: wx.ListBox drag and drop
Re: is vec.reserve(unsigned int) better than vec(unsigned int)?
Re: Not to forget "my friends" here in clc++...
blanquimorales.com
Spiewaj-glosno Ulma Biz
frezy do metalu
Bajki
reklamy łódź