Am Thursday 29 April 2010 09:59:22 schrieb Xavier Ho:
> On Thu, Apr 29, 2010 at 5:55 PM, Richard Lamboj 
<richard.lam...@bilcom.at>wrote:
> > Hello,
> >
> > i want to add functions to an instance of a class at runtime. The added
> > function should contain a default parameter value. The function name and
> > function default paramter values should be set dynamical.
> >
> > Kind Regards,
> >
> > Richi
> >  <http://mail.python.org/mailman/listinfo/python-list>
>
> What did you mean by "The function name and function default paramter
> values should be set dynamical." ? Also, have you tried anything we can
> see?
>
> Cheers,
> Xav

No i don't have any sample code.

I just want to add new functions to an class instance at runtime and i also 
want to set the default parameter values of this new function.

Dynamical:
Class Test(object):
        def add_function(self, function_name="new_function", param="new_param", 
value="new_value"):
                ...

or something like:

Class Test(object):
        def add_function(self, function_name="new_function", 
parameters=[["param1", "value1"],["param2", "value2"]]):
                ...

Statical created it would look like:
Class Test(object):
        def new_function1(new_parm1="new_value1"):
                pass
        def new_function2(new_parm2="new_value2"):
                pass
        def new_function3(new_parm3="new_value3"):
                pass

Kind Regards,

Richi
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to