On Feb 13, 5:51 pm, azrael <[EMAIL PROTECTED]> wrote:
> I came across the fromfunc() function in numpy where you pass as an
> argument the name of a function as a string and also the atributes for
> the desired function.
>
> I find this extremly usefull and sexy. Can someone point me how write
> a function of such capabilities

class test_class():
    def test_func(self, string):
        print string

test = test_class()
getattr(test, 'test_class'){'this is the test argument')

getattr raises an Attribute Error though if the function doesn't exist
so you'll need to catch that.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to